Initial commit
This commit is contained in:
542
#pma/libraries/config/ConfigFile.php
Normal file
542
#pma/libraries/config/ConfigFile.php
Normal file
@ -0,0 +1,542 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Config file management
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
namespace PMA\libraries\config;
|
||||
|
||||
use PMA\libraries\Config;
|
||||
|
||||
/**
|
||||
* Config file management class.
|
||||
* Stores its data in $_SESSION
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class ConfigFile
|
||||
{
|
||||
/**
|
||||
* Stores default PMA config from config.default.php
|
||||
* @var array
|
||||
*/
|
||||
private $_defaultCfg;
|
||||
|
||||
/**
|
||||
* Stores allowed values for non-standard fields
|
||||
* @var array
|
||||
*/
|
||||
private $_cfgDb;
|
||||
|
||||
/**
|
||||
* Stores original PMA config, not modified by user preferences
|
||||
* @var Config
|
||||
*/
|
||||
private $_baseCfg;
|
||||
|
||||
/**
|
||||
* Whether we are currently working in PMA Setup context
|
||||
* @var bool
|
||||
*/
|
||||
private $_isInSetup;
|
||||
|
||||
/**
|
||||
* Keys which will be always written to config file
|
||||
* @var array
|
||||
*/
|
||||
private $_persistKeys = array();
|
||||
|
||||
/**
|
||||
* Changes keys while updating config in {@link updateWithGlobalConfig()}
|
||||
* or reading by {@link getConfig()} or {@link getConfigArray()}
|
||||
* @var array
|
||||
*/
|
||||
private $_cfgUpdateReadMapping = array();
|
||||
|
||||
/**
|
||||
* Key filter for {@link set()}
|
||||
* @var array|null
|
||||
*/
|
||||
private $_setFilter;
|
||||
|
||||
/**
|
||||
* Instance id (key in $_SESSION array, separate for each server -
|
||||
* ConfigFile{server id})
|
||||
* @var string
|
||||
*/
|
||||
private $_id;
|
||||
|
||||
/**
|
||||
* Result for {@link _flattenArray()}
|
||||
* @var array|null
|
||||
*/
|
||||
private $_flattenArrayResult;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $base_config base configuration read from
|
||||
* {@link PMA\libraries\Config::$base_config},
|
||||
* use only when not in PMA Setup
|
||||
*/
|
||||
public function __construct(array $base_config = null)
|
||||
{
|
||||
// load default config values
|
||||
$cfg = &$this->_defaultCfg;
|
||||
include './libraries/config.default.php';
|
||||
$cfg['fontsize'] = '82%';
|
||||
|
||||
// load additional config information
|
||||
$cfg_db = &$this->_cfgDb;
|
||||
include './libraries/config.values.php';
|
||||
|
||||
// apply default values overrides
|
||||
if (count($cfg_db['_overrides'])) {
|
||||
foreach ($cfg_db['_overrides'] as $path => $value) {
|
||||
PMA_arrayWrite($path, $cfg, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$this->_baseCfg = $base_config;
|
||||
$this->_isInSetup = is_null($base_config);
|
||||
$this->_id = 'ConfigFile' . $GLOBALS['server'];
|
||||
if (!isset($_SESSION[$this->_id])) {
|
||||
$_SESSION[$this->_id] = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets names of config options which will be placed in config file even if
|
||||
* they are set to their default values (use only full paths)
|
||||
*
|
||||
* @param array $keys the names of the config options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPersistKeys(array $keys)
|
||||
{
|
||||
// checking key presence is much faster than searching so move values
|
||||
// to keys
|
||||
$this->_persistKeys = array_flip($keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns flipped array set by {@link setPersistKeys()}
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPersistKeysMap()
|
||||
{
|
||||
return $this->_persistKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* By default ConfigFile allows setting of all configuration keys, use
|
||||
* this method to set up a filter on {@link set()} method
|
||||
*
|
||||
* @param array|null $keys array of allowed keys or null to remove filter
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAllowedKeys($keys)
|
||||
{
|
||||
if ($keys === null) {
|
||||
$this->_setFilter = null;
|
||||
return;
|
||||
}
|
||||
// checking key presence is much faster than searching so move values
|
||||
// to keys
|
||||
$this->_setFilter = array_flip($keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets path mapping for updating config in
|
||||
* {@link updateWithGlobalConfig()} or reading
|
||||
* by {@link getConfig()} or {@link getConfigArray()}
|
||||
*
|
||||
* @param array $mapping Contains the mapping of "Server/config options"
|
||||
* to "Server/1/config options"
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCfgUpdateReadMapping(array $mapping)
|
||||
{
|
||||
$this->_cfgUpdateReadMapping = $mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets configuration data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resetConfigData()
|
||||
{
|
||||
$_SESSION[$this->_id] = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets configuration data (overrides old data)
|
||||
*
|
||||
* @param array $cfg Configuration options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setConfigData(array $cfg)
|
||||
{
|
||||
$_SESSION[$this->_id] = $cfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets config value
|
||||
*
|
||||
* @param string $path Path
|
||||
* @param mixed $value Value
|
||||
* @param string $canonical_path Canonical path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($path, $value, $canonical_path = null)
|
||||
{
|
||||
if ($canonical_path === null) {
|
||||
$canonical_path = $this->getCanonicalPath($path);
|
||||
}
|
||||
// apply key whitelist
|
||||
if ($this->_setFilter !== null
|
||||
&& ! isset($this->_setFilter[$canonical_path])
|
||||
) {
|
||||
return;
|
||||
}
|
||||
// if the path isn't protected it may be removed
|
||||
if (isset($this->_persistKeys[$canonical_path])) {
|
||||
PMA_arrayWrite($path, $_SESSION[$this->_id], $value);
|
||||
return;
|
||||
}
|
||||
|
||||
$default_value = $this->getDefault($canonical_path);
|
||||
$remove_path = $value === $default_value;
|
||||
if ($this->_isInSetup) {
|
||||
// remove if it has a default value or is empty
|
||||
$remove_path = $remove_path
|
||||
|| (empty($value) && empty($default_value));
|
||||
} else {
|
||||
// get original config values not overwritten by user
|
||||
// preferences to allow for overwriting options set in
|
||||
// config.inc.php with default values
|
||||
$instance_default_value = PMA_arrayRead(
|
||||
$canonical_path,
|
||||
$this->_baseCfg
|
||||
);
|
||||
// remove if it has a default value and base config (config.inc.php)
|
||||
// uses default value
|
||||
$remove_path = $remove_path
|
||||
&& ($instance_default_value === $default_value);
|
||||
}
|
||||
if ($remove_path) {
|
||||
PMA_arrayRemove($path, $_SESSION[$this->_id]);
|
||||
return;
|
||||
}
|
||||
|
||||
PMA_arrayWrite($path, $_SESSION[$this->_id], $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flattens multidimensional array, changes indices to paths
|
||||
* (eg. 'key/subkey').
|
||||
* Used as array_walk() callback.
|
||||
*
|
||||
* @param mixed $value Value
|
||||
* @param mixed $key Key
|
||||
* @param mixed $prefix Prefix
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _flattenArray($value, $key, $prefix)
|
||||
{
|
||||
// no recursion for numeric arrays
|
||||
if (is_array($value) && !isset($value[0])) {
|
||||
$prefix .= $key . '/';
|
||||
array_walk($value, array($this, '_flattenArray'), $prefix);
|
||||
} else {
|
||||
$this->_flattenArrayResult[$prefix . $key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns default config in a flattened array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getFlatDefaultConfig()
|
||||
{
|
||||
$this->_flattenArrayResult = array();
|
||||
array_walk($this->_defaultCfg, array($this, '_flattenArray'), '');
|
||||
$flat_cfg = $this->_flattenArrayResult;
|
||||
$this->_flattenArrayResult = null;
|
||||
return $flat_cfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates config with values read from given array
|
||||
* (config will contain differences to defaults from config.defaults.php).
|
||||
*
|
||||
* @param array $cfg Configuration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updateWithGlobalConfig(array $cfg)
|
||||
{
|
||||
// load config array and flatten it
|
||||
$this->_flattenArrayResult = array();
|
||||
array_walk($cfg, array($this, '_flattenArray'), '');
|
||||
$flat_cfg = $this->_flattenArrayResult;
|
||||
$this->_flattenArrayResult = null;
|
||||
|
||||
// save values map for translating a few user preferences paths,
|
||||
// should be complemented by code reading from generated config
|
||||
// to perform inverse mapping
|
||||
foreach ($flat_cfg as $path => $value) {
|
||||
if (isset($this->_cfgUpdateReadMapping[$path])) {
|
||||
$path = $this->_cfgUpdateReadMapping[$path];
|
||||
}
|
||||
$this->set($path, $value, $path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns config value or $default if it's not set
|
||||
*
|
||||
* @param string $path Path of config file
|
||||
* @param mixed $default Default values
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($path, $default = null)
|
||||
{
|
||||
return PMA_arrayRead($path, $_SESSION[$this->_id], $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns default config value or $default it it's not set ie. it doesn't
|
||||
* exist in config.default.php ($cfg) and config.values.php
|
||||
* ($_cfg_db['_overrides'])
|
||||
*
|
||||
* @param string $canonical_path Canonical path
|
||||
* @param mixed $default Default value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDefault($canonical_path, $default = null)
|
||||
{
|
||||
return PMA_arrayRead($canonical_path, $this->_defaultCfg, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns config value, if it's not set uses the default one; returns
|
||||
* $default if the path isn't set and doesn't contain a default value
|
||||
*
|
||||
* @param string $path Path
|
||||
* @param mixed $default Default value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue($path, $default = null)
|
||||
{
|
||||
$v = PMA_arrayRead($path, $_SESSION[$this->_id], null);
|
||||
if ($v !== null) {
|
||||
return $v;
|
||||
}
|
||||
$path = $this->getCanonicalPath($path);
|
||||
return $this->getDefault($path, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns canonical path
|
||||
*
|
||||
* @param string $path Path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCanonicalPath($path)
|
||||
{
|
||||
return preg_replace('#^Servers/([\d]+)/#', 'Servers/1/', $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns config database entry for $path ($cfg_db in config_info.php)
|
||||
*
|
||||
* @param string $path path of the variable in config db
|
||||
* @param mixed $default default value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDbEntry($path, $default = null)
|
||||
{
|
||||
return PMA_arrayRead($path, $this->_cfgDb, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns server count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getServerCount()
|
||||
{
|
||||
return isset($_SESSION[$this->_id]['Servers'])
|
||||
? count($_SESSION[$this->_id]['Servers'])
|
||||
: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns server list
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getServers()
|
||||
{
|
||||
return isset($_SESSION[$this->_id]['Servers'])
|
||||
? $_SESSION[$this->_id]['Servers']
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns DSN of given server
|
||||
*
|
||||
* @param integer $server server index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getServerDSN($server)
|
||||
{
|
||||
if (!isset($_SESSION[$this->_id]['Servers'][$server])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$path = 'Servers/' . $server;
|
||||
$dsn = 'mysqli://';
|
||||
if ($this->getValue("$path/auth_type") == 'config') {
|
||||
$dsn .= $this->getValue("$path/user");
|
||||
if (! $this->getValue("$path/nopassword")
|
||||
|| ! empty($this->getValue("$path/password"))
|
||||
) {
|
||||
$dsn .= ':***';
|
||||
}
|
||||
$dsn .= '@';
|
||||
}
|
||||
if ($this->getValue("$path/connect_type") == 'tcp') {
|
||||
$dsn .= $this->getValue("$path/host");
|
||||
$port = $this->getValue("$path/port");
|
||||
if ($port) {
|
||||
$dsn .= ':' . $port;
|
||||
}
|
||||
} else {
|
||||
$dsn .= $this->getValue("$path/socket");
|
||||
}
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns server name
|
||||
*
|
||||
* @param int $id server index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getServerName($id)
|
||||
{
|
||||
if (!isset($_SESSION[$this->_id]['Servers'][$id])) {
|
||||
return '';
|
||||
}
|
||||
$verbose = $this->get("Servers/$id/verbose");
|
||||
if (!empty($verbose)) {
|
||||
return $verbose;
|
||||
}
|
||||
$host = $this->get("Servers/$id/host");
|
||||
return empty($host) ? 'localhost' : $host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes server
|
||||
*
|
||||
* @param int $server server index
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeServer($server)
|
||||
{
|
||||
if (!isset($_SESSION[$this->_id]['Servers'][$server])) {
|
||||
return;
|
||||
}
|
||||
$last_server = $this->getServerCount();
|
||||
|
||||
for ($i = $server; $i < $last_server; $i++) {
|
||||
$_SESSION[$this->_id]['Servers'][$i]
|
||||
= $_SESSION[$this->_id]['Servers'][$i + 1];
|
||||
}
|
||||
unset($_SESSION[$this->_id]['Servers'][$last_server]);
|
||||
|
||||
if (isset($_SESSION[$this->_id]['ServerDefault'])
|
||||
&& $_SESSION[$this->_id]['ServerDefault'] == $last_server
|
||||
) {
|
||||
unset($_SESSION[$this->_id]['ServerDefault']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns config file path, relative to phpMyAdmin's root path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilePath()
|
||||
{
|
||||
return SETUP_CONFIG_FILE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns configuration array (full, multidimensional format)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
$c = $_SESSION[$this->_id];
|
||||
foreach ($this->_cfgUpdateReadMapping as $map_to => $map_from) {
|
||||
// if the key $c exists in $map_to
|
||||
if (PMA_arrayRead($map_to, $c) !== null) {
|
||||
PMA_arrayWrite($map_to, $c, PMA_arrayRead($map_from, $c));
|
||||
PMA_arrayRemove($map_from, $c);
|
||||
}
|
||||
}
|
||||
return $c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns configuration array (flat format)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getConfigArray()
|
||||
{
|
||||
$this->_flattenArrayResult = array();
|
||||
array_walk($_SESSION[$this->_id], array($this, '_flattenArray'), '');
|
||||
$c = $this->_flattenArrayResult;
|
||||
$this->_flattenArrayResult = null;
|
||||
|
||||
$persistKeys = array_diff(
|
||||
array_keys($this->_persistKeys),
|
||||
array_keys($c)
|
||||
);
|
||||
foreach ($persistKeys as $k) {
|
||||
$c[$k] = $this->getDefault($this->getCanonicalPath($k));
|
||||
}
|
||||
|
||||
foreach ($this->_cfgUpdateReadMapping as $map_to => $map_from) {
|
||||
if (!isset($c[$map_from])) {
|
||||
continue;
|
||||
}
|
||||
$c[$map_to] = $c[$map_from];
|
||||
unset($c[$map_from]);
|
||||
}
|
||||
return $c;
|
||||
}
|
||||
}
|
231
#pma/libraries/config/Form.php
Normal file
231
#pma/libraries/config/Form.php
Normal file
@ -0,0 +1,231 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Form handling code.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
namespace PMA\libraries\config;
|
||||
|
||||
/**
|
||||
* Base class for forms, loads default configuration options, checks allowed
|
||||
* values etc.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class Form
|
||||
{
|
||||
/**
|
||||
* Form name
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Arbitrary index, doesn't affect class' behavior
|
||||
* @var int
|
||||
*/
|
||||
public $index;
|
||||
|
||||
/**
|
||||
* Form fields (paths), filled by {@link readFormPaths()}, indexed by field name
|
||||
* @var array
|
||||
*/
|
||||
public $fields;
|
||||
|
||||
/**
|
||||
* Stores default values for some fields (eg. pmadb tables)
|
||||
* @var array
|
||||
*/
|
||||
public $default;
|
||||
|
||||
/**
|
||||
* Caches field types, indexed by field names
|
||||
* @var array
|
||||
*/
|
||||
private $_fieldsTypes;
|
||||
|
||||
/**
|
||||
* ConfigFile instance
|
||||
* @var ConfigFile
|
||||
*/
|
||||
private $_configFile;
|
||||
|
||||
/**
|
||||
* Constructor, reads default config values
|
||||
*
|
||||
* @param string $form_name Form name
|
||||
* @param array $form Form data
|
||||
* @param ConfigFile $cf Config file instance
|
||||
* @param int $index arbitrary index, stored in Form::$index
|
||||
*/
|
||||
public function __construct(
|
||||
$form_name, array $form, ConfigFile $cf, $index = null
|
||||
) {
|
||||
$this->index = $index;
|
||||
$this->_configFile = $cf;
|
||||
$this->loadForm($form_name, $form);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns type of given option
|
||||
*
|
||||
* @param string $option_name path or field name
|
||||
*
|
||||
* @return string|null one of: boolean, integer, double, string, select, array
|
||||
*/
|
||||
public function getOptionType($option_name)
|
||||
{
|
||||
$key = ltrim(
|
||||
mb_substr(
|
||||
$option_name,
|
||||
mb_strrpos($option_name, '/')
|
||||
),
|
||||
'/'
|
||||
);
|
||||
return isset($this->_fieldsTypes[$key])
|
||||
? $this->_fieldsTypes[$key]
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns allowed values for select fields
|
||||
*
|
||||
* @param string $option_path Option path
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptionValueList($option_path)
|
||||
{
|
||||
$value = $this->_configFile->getDbEntry($option_path);
|
||||
if ($value === null) {
|
||||
trigger_error("$option_path - select options not defined", E_USER_ERROR);
|
||||
return array();
|
||||
}
|
||||
if (!is_array($value)) {
|
||||
trigger_error("$option_path - not a static value list", E_USER_ERROR);
|
||||
return array();
|
||||
}
|
||||
// convert array('#', 'a', 'b') to array('a', 'b')
|
||||
if (isset($value[0]) && $value[0] === '#') {
|
||||
// remove first element ('#')
|
||||
array_shift($value);
|
||||
// $value has keys and value names, return it
|
||||
return $value;
|
||||
}
|
||||
|
||||
// convert value list array('a', 'b') to array('a' => 'a', 'b' => 'b')
|
||||
$has_string_keys = false;
|
||||
$keys = array();
|
||||
for ($i = 0, $nb = count($value); $i < $nb; $i++) {
|
||||
if (!isset($value[$i])) {
|
||||
$has_string_keys = true;
|
||||
break;
|
||||
}
|
||||
$keys[] = is_bool($value[$i]) ? (int)$value[$i] : $value[$i];
|
||||
}
|
||||
if (! $has_string_keys) {
|
||||
$value = array_combine($keys, $value);
|
||||
}
|
||||
|
||||
// $value has keys and value names, return it
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* array_walk callback function, reads path of form fields from
|
||||
* array (see file comment in setup.forms.php or user_preferences.forms.inc)
|
||||
*
|
||||
* @param mixed $value Value
|
||||
* @param mixed $key Key
|
||||
* @param mixed $prefix Prefix
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _readFormPathsCallback($value, $key, $prefix)
|
||||
{
|
||||
static $group_counter = 0;
|
||||
|
||||
if (is_array($value)) {
|
||||
$prefix .= $key . '/';
|
||||
array_walk($value, array($this, '_readFormPathsCallback'), $prefix);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_int($key)) {
|
||||
$this->default[$prefix . $key] = $value;
|
||||
$value = $key;
|
||||
}
|
||||
// add unique id to group ends
|
||||
if ($value == ':group:end') {
|
||||
$value .= ':' . $group_counter++;
|
||||
}
|
||||
$this->fields[] = $prefix . $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads form paths to {@link $fields}
|
||||
*
|
||||
* @param array $form Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function readFormPaths($form)
|
||||
{
|
||||
// flatten form fields' paths and save them to $fields
|
||||
$this->fields = array();
|
||||
array_walk($form, array($this, '_readFormPathsCallback'), '');
|
||||
|
||||
// $this->fields is an array of the form: [0..n] => 'field path'
|
||||
// change numeric indexes to contain field names (last part of the path)
|
||||
$paths = $this->fields;
|
||||
$this->fields = array();
|
||||
foreach ($paths as $path) {
|
||||
$key = ltrim(
|
||||
mb_substr($path, mb_strrpos($path, '/')),
|
||||
'/'
|
||||
);
|
||||
$this->fields[$key] = $path;
|
||||
}
|
||||
// now $this->fields is an array of the form: 'field name' => 'field path'
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads fields' types to $this->_fieldsTypes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function readTypes()
|
||||
{
|
||||
$cf = $this->_configFile;
|
||||
foreach ($this->fields as $name => $path) {
|
||||
if (mb_strpos($name, ':group:') === 0) {
|
||||
$this->_fieldsTypes[$name] = 'group';
|
||||
continue;
|
||||
}
|
||||
$v = $cf->getDbEntry($path);
|
||||
if ($v !== null) {
|
||||
$type = is_array($v) ? 'select' : $v;
|
||||
} else {
|
||||
$type = gettype($cf->getDefault($path));
|
||||
}
|
||||
$this->_fieldsTypes[$name] = $type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads form settings and prepares class to work with given subset of
|
||||
* config file
|
||||
*
|
||||
* @param string $form_name Form name
|
||||
* @param array $form Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadForm($form_name, $form)
|
||||
{
|
||||
$this->name = $form_name;
|
||||
$this->readFormPaths($form);
|
||||
$this->readTypes();
|
||||
}
|
||||
}
|
887
#pma/libraries/config/FormDisplay.php
Normal file
887
#pma/libraries/config/FormDisplay.php
Normal file
@ -0,0 +1,887 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Form management class, displays and processes forms
|
||||
*
|
||||
* Explanation of used terms:
|
||||
* o work_path - original field path, eg. Servers/4/verbose
|
||||
* o system_path - work_path modified so that it points to the first server,
|
||||
* eg. Servers/1/verbose
|
||||
* o translated_path - work_path modified for HTML field name, a path with
|
||||
* slashes changed to hyphens, eg. Servers-4-verbose
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
namespace PMA\libraries\config;
|
||||
|
||||
/**
|
||||
* Core libraries.
|
||||
*/
|
||||
use PMA\libraries\Util;
|
||||
|
||||
require_once './libraries/js_escape.lib.php';
|
||||
require_once './libraries/config/FormDisplay.tpl.php';
|
||||
|
||||
/**
|
||||
* Form management class, displays and processes forms
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class FormDisplay
|
||||
{
|
||||
/**
|
||||
* ConfigFile instance
|
||||
* @var ConfigFile
|
||||
*/
|
||||
private $_configFile;
|
||||
|
||||
/**
|
||||
* Form list
|
||||
* @var Form[]
|
||||
*/
|
||||
private $_forms = array();
|
||||
|
||||
/**
|
||||
* Stores validation errors, indexed by paths
|
||||
* [ Form_name ] is an array of form errors
|
||||
* [path] is a string storing error associated with single field
|
||||
* @var array
|
||||
*/
|
||||
private $_errors = array();
|
||||
|
||||
/**
|
||||
* Paths changed so that they can be used as HTML ids, indexed by paths
|
||||
* @var array
|
||||
*/
|
||||
private $_translatedPaths = array();
|
||||
|
||||
/**
|
||||
* Server paths change indexes so we define maps from current server
|
||||
* path to the first one, indexed by work path
|
||||
* @var array
|
||||
*/
|
||||
private $_systemPaths = array();
|
||||
|
||||
/**
|
||||
* Language strings which will be sent to PMA_messages JS variable
|
||||
* Will be looked up in $GLOBALS: str{value} or strSetup{value}
|
||||
* @var array
|
||||
*/
|
||||
private $_jsLangStrings = array();
|
||||
|
||||
/**
|
||||
* Tells whether forms have been validated
|
||||
* @var bool
|
||||
*/
|
||||
private $_isValidated = true;
|
||||
|
||||
/**
|
||||
* Dictionary with user preferences keys
|
||||
* @var array|null
|
||||
*/
|
||||
private $_userprefsKeys;
|
||||
|
||||
/**
|
||||
* Dictionary with disallowed user preferences keys
|
||||
* @var array
|
||||
*/
|
||||
private $_userprefsDisallow;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param ConfigFile $cf Config file instance
|
||||
*/
|
||||
public function __construct(ConfigFile $cf)
|
||||
{
|
||||
$this->_jsLangStrings = array(
|
||||
'error_nan_p' => __('Not a positive number!'),
|
||||
'error_nan_nneg' => __('Not a non-negative number!'),
|
||||
'error_incorrect_port' => __('Not a valid port number!'),
|
||||
'error_invalid_value' => __('Incorrect value!'),
|
||||
'error_value_lte' => __('Value must be equal or lower than %s!'));
|
||||
$this->_configFile = $cf;
|
||||
// initialize validators
|
||||
Validator::getValidators($this->_configFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link ConfigFile} associated with this instance
|
||||
*
|
||||
* @return ConfigFile
|
||||
*/
|
||||
public function getConfigFile()
|
||||
{
|
||||
return $this->_configFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers form in form manager
|
||||
*
|
||||
* @param string $form_name Form name
|
||||
* @param array $form Form data
|
||||
* @param int $server_id 0 if new server, validation; >= 1 if editing a server
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerForm($form_name, array $form, $server_id = null)
|
||||
{
|
||||
$this->_forms[$form_name] = new Form(
|
||||
$form_name, $form, $this->_configFile, $server_id
|
||||
);
|
||||
$this->_isValidated = false;
|
||||
foreach ($this->_forms[$form_name]->fields as $path) {
|
||||
$work_path = $server_id === null
|
||||
? $path
|
||||
: str_replace('Servers/1/', "Servers/$server_id/", $path);
|
||||
$this->_systemPaths[$work_path] = $path;
|
||||
$this->_translatedPaths[$work_path] = str_replace('/', '-', $work_path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
if ($check_form_submit && !isset($_POST['submit_save'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// save forms
|
||||
if (count($this->_forms) > 0) {
|
||||
return $this->save(array_keys($this->_forms), $allow_partial_save);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs validation for all registered forms
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _validate()
|
||||
{
|
||||
if ($this->_isValidated) {
|
||||
return;
|
||||
}
|
||||
|
||||
$paths = array();
|
||||
$values = array();
|
||||
foreach ($this->_forms as $form) {
|
||||
/* @var $form Form */
|
||||
$paths[] = $form->name;
|
||||
// collect values and paths
|
||||
foreach ($form->fields as $path) {
|
||||
$work_path = array_search($path, $this->_systemPaths);
|
||||
$values[$path] = $this->_configFile->getValue($work_path);
|
||||
$paths[] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
// run validation
|
||||
$errors = Validator::validate(
|
||||
$this->_configFile, $paths, $values, false
|
||||
);
|
||||
|
||||
// change error keys from canonical paths to work paths
|
||||
if (is_array($errors) && count($errors) > 0) {
|
||||
$this->_errors = array();
|
||||
foreach ($errors as $path => $error_list) {
|
||||
$work_path = array_search($path, $this->_systemPaths);
|
||||
// field error
|
||||
if (! $work_path) {
|
||||
// form error, fix path
|
||||
$work_path = $path;
|
||||
}
|
||||
$this->_errors[$work_path] = $error_list;
|
||||
}
|
||||
}
|
||||
$this->_isValidated = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs HTML for the forms under the menu tab
|
||||
*
|
||||
* @param bool $show_restore_default whether to show "restore default"
|
||||
* button besides the input field
|
||||
* @param array &$js_default stores JavaScript code
|
||||
* to be displayed
|
||||
* @param array &$js will be updated with javascript code
|
||||
* @param bool $show_buttons whether show submit and reset button
|
||||
*
|
||||
* @return string $htmlOutput
|
||||
*/
|
||||
private function _displayForms(
|
||||
$show_restore_default, array &$js_default, array &$js, $show_buttons
|
||||
) {
|
||||
$htmlOutput = '';
|
||||
$validators = Validator::getValidators($this->_configFile);
|
||||
|
||||
foreach ($this->_forms as $form) {
|
||||
/* @var $form Form */
|
||||
$form_desc = isset($GLOBALS["strConfigForm_{$form->name}_desc"])
|
||||
? PMA_lang("Form_{$form->name}_desc")
|
||||
: '';
|
||||
$form_errors = isset($this->_errors[$form->name])
|
||||
? $this->_errors[$form->name] : null;
|
||||
$htmlOutput .= PMA_displayFieldsetTop(
|
||||
PMA_lang("Form_$form->name"),
|
||||
$form_desc,
|
||||
$form_errors,
|
||||
array('id' => $form->name)
|
||||
);
|
||||
|
||||
foreach ($form->fields as $field => $path) {
|
||||
$work_path = array_search($path, $this->_systemPaths);
|
||||
$translated_path = $this->_translatedPaths[$work_path];
|
||||
// always true/false for user preferences display
|
||||
// otherwise null
|
||||
$userprefs_allow = isset($this->_userprefsKeys[$path])
|
||||
? !isset($this->_userprefsDisallow[$path])
|
||||
: null;
|
||||
// display input
|
||||
$htmlOutput .= $this->_displayFieldInput(
|
||||
$form,
|
||||
$field,
|
||||
$path,
|
||||
$work_path,
|
||||
$translated_path,
|
||||
$show_restore_default,
|
||||
$userprefs_allow,
|
||||
$js_default
|
||||
);
|
||||
// register JS validators for this field
|
||||
if (isset($validators[$path])) {
|
||||
PMA_addJsValidate($translated_path, $validators[$path], $js);
|
||||
}
|
||||
}
|
||||
$htmlOutput .= PMA_displayFieldsetBottom($show_buttons);
|
||||
}
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs HTML for forms
|
||||
*
|
||||
* @param bool $tabbed_form if true, use a form with tabs
|
||||
* @param bool $show_restore_default whether show "restore default" button
|
||||
* besides the input field
|
||||
* @param bool $show_buttons whether show submit and reset button
|
||||
* @param string $form_action action attribute for the form
|
||||
* @param array $hidden_fields array of form hidden fields (key: field
|
||||
* name)
|
||||
*
|
||||
* @return string HTML for forms
|
||||
*/
|
||||
public function getDisplay(
|
||||
$tabbed_form = false,
|
||||
$show_restore_default = false,
|
||||
$show_buttons = true,
|
||||
$form_action = null,
|
||||
$hidden_fields = null
|
||||
) {
|
||||
static $js_lang_sent = false;
|
||||
|
||||
$htmlOutput = '';
|
||||
|
||||
$js = array();
|
||||
$js_default = array();
|
||||
|
||||
$htmlOutput .= PMA_displayFormTop($form_action, 'post', $hidden_fields);
|
||||
|
||||
if ($tabbed_form) {
|
||||
$tabs = array();
|
||||
foreach ($this->_forms as $form) {
|
||||
$tabs[$form->name] = PMA_lang("Form_$form->name");
|
||||
}
|
||||
$htmlOutput .= PMA_displayTabsTop($tabs);
|
||||
}
|
||||
|
||||
// validate only when we aren't displaying a "new server" form
|
||||
$is_new_server = false;
|
||||
foreach ($this->_forms as $form) {
|
||||
/* @var $form Form */
|
||||
if ($form->index === 0) {
|
||||
$is_new_server = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (! $is_new_server) {
|
||||
$this->_validate();
|
||||
}
|
||||
|
||||
// user preferences
|
||||
$this->_loadUserprefsInfo();
|
||||
|
||||
// display forms
|
||||
$htmlOutput .= $this->_displayForms(
|
||||
$show_restore_default, $js_default, $js, $show_buttons
|
||||
);
|
||||
|
||||
if ($tabbed_form) {
|
||||
$htmlOutput .= PMA_displayTabsBottom();
|
||||
}
|
||||
$htmlOutput .= PMA_displayFormBottom();
|
||||
|
||||
// if not already done, send strings used for validation to JavaScript
|
||||
if (! $js_lang_sent) {
|
||||
$js_lang_sent = true;
|
||||
$js_lang = array();
|
||||
foreach ($this->_jsLangStrings as $strName => $strValue) {
|
||||
$js_lang[] = "'$strName': '" . PMA_jsFormat($strValue, false) . '\'';
|
||||
}
|
||||
$js[] = "$.extend(PMA_messages, {\n\t"
|
||||
. implode(",\n\t", $js_lang) . '})';
|
||||
}
|
||||
|
||||
$js[] = "$.extend(defaultValues, {\n\t"
|
||||
. implode(",\n\t", $js_default) . '})';
|
||||
$htmlOutput .= PMA_displayJavascript($js);
|
||||
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares data for input field display and outputs HTML code
|
||||
*
|
||||
* @param Form $form Form object
|
||||
* @param string $field field name as it appears in $form
|
||||
* @param string $system_path field path, eg. Servers/1/verbose
|
||||
* @param string $work_path work path, eg. Servers/4/verbose
|
||||
* @param string $translated_path work path changed so that it can be
|
||||
* used as XHTML id
|
||||
* @param bool $show_restore_default whether show "restore default" button
|
||||
* besides the input field
|
||||
* @param bool|null $userprefs_allow whether user preferences are enabled
|
||||
* for this field (null - no support,
|
||||
* true/false - enabled/disabled)
|
||||
* @param array &$js_default array which stores JavaScript code
|
||||
* to be displayed
|
||||
*
|
||||
* @return string HTML for input field
|
||||
*/
|
||||
private function _displayFieldInput(
|
||||
Form $form, $field, $system_path, $work_path,
|
||||
$translated_path, $show_restore_default, $userprefs_allow, array &$js_default
|
||||
) {
|
||||
$name = PMA_langName($system_path);
|
||||
$description = PMA_langName($system_path, 'desc', '');
|
||||
|
||||
$value = $this->_configFile->get($work_path);
|
||||
$value_default = $this->_configFile->getDefault($system_path);
|
||||
$value_is_default = false;
|
||||
if ($value === null || $value === $value_default) {
|
||||
$value = $value_default;
|
||||
$value_is_default = true;
|
||||
}
|
||||
|
||||
$opts = array(
|
||||
'doc' => $this->getDocLink($system_path),
|
||||
'show_restore_default' => $show_restore_default,
|
||||
'userprefs_allow' => $userprefs_allow,
|
||||
'userprefs_comment' => PMA_langName($system_path, 'cmt', ''));
|
||||
if (isset($form->default[$system_path])) {
|
||||
$opts['setvalue'] = $form->default[$system_path];
|
||||
}
|
||||
|
||||
if (isset($this->_errors[$work_path])) {
|
||||
$opts['errors'] = $this->_errors[$work_path];
|
||||
}
|
||||
|
||||
$type = '';
|
||||
switch ($form->getOptionType($field)) {
|
||||
case 'string':
|
||||
$type = 'text';
|
||||
break;
|
||||
case 'short_string':
|
||||
$type = 'short_text';
|
||||
break;
|
||||
case 'double':
|
||||
case 'integer':
|
||||
$type = 'number_text';
|
||||
break;
|
||||
case 'boolean':
|
||||
$type = 'checkbox';
|
||||
break;
|
||||
case 'select':
|
||||
$type = 'select';
|
||||
$opts['values'] = $form->getOptionValueList($form->fields[$field]);
|
||||
break;
|
||||
case 'array':
|
||||
$type = 'list';
|
||||
$value = (array) $value;
|
||||
$value_default = (array) $value_default;
|
||||
break;
|
||||
case 'group':
|
||||
// :group:end is changed to :group:end:{unique id} in Form class
|
||||
$htmlOutput = '';
|
||||
if (mb_substr($field, 7, 4) != 'end:') {
|
||||
$htmlOutput .= PMA_displayGroupHeader(
|
||||
mb_substr($field, 7)
|
||||
);
|
||||
} else {
|
||||
PMA_displayGroupFooter();
|
||||
}
|
||||
return $htmlOutput;
|
||||
case 'NULL':
|
||||
trigger_error("Field $system_path has no type", E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
|
||||
// detect password fields
|
||||
if ($type === 'text'
|
||||
&& (mb_substr($translated_path, -9) === '-password'
|
||||
|| mb_substr($translated_path, -4) === 'pass'
|
||||
|| mb_substr($translated_path, -4) === 'Pass')
|
||||
) {
|
||||
$type = 'password';
|
||||
}
|
||||
|
||||
// TrustedProxies requires changes before displaying
|
||||
if ($system_path == 'TrustedProxies') {
|
||||
foreach ($value as $ip => &$v) {
|
||||
if (!preg_match('/^-\d+$/', $ip)) {
|
||||
$v = $ip . ': ' . $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_setComments($system_path, $opts);
|
||||
|
||||
// send default value to form's JS
|
||||
$js_line = '\'' . $translated_path . '\': ';
|
||||
switch ($type) {
|
||||
case 'text':
|
||||
case 'short_text':
|
||||
case 'number_text':
|
||||
case 'password':
|
||||
$js_line .= '\'' . PMA_escapeJsString($value_default) . '\'';
|
||||
break;
|
||||
case 'checkbox':
|
||||
$js_line .= $value_default ? 'true' : 'false';
|
||||
break;
|
||||
case 'select':
|
||||
$value_default_js = is_bool($value_default)
|
||||
? (int) $value_default
|
||||
: $value_default;
|
||||
$js_line .= '[\'' . PMA_escapeJsString($value_default_js) . '\']';
|
||||
break;
|
||||
case 'list':
|
||||
$js_line .= '\'' . PMA_escapeJsString(implode("\n", $value_default))
|
||||
. '\'';
|
||||
break;
|
||||
}
|
||||
$js_default[] = $js_line;
|
||||
|
||||
return PMA_displayInput(
|
||||
$translated_path, $name, $type, $value,
|
||||
$description, $value_is_default, $opts
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays errors
|
||||
*
|
||||
* @return string HTML for errors
|
||||
*/
|
||||
public function displayErrors()
|
||||
{
|
||||
$this->_validate();
|
||||
if (count($this->_errors) == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$htmlOutput = '';
|
||||
|
||||
foreach ($this->_errors as $system_path => $error_list) {
|
||||
if (isset($this->_systemPaths[$system_path])) {
|
||||
$path = $this->_systemPaths[$system_path];
|
||||
$name = PMA_langName($path);
|
||||
} else {
|
||||
$name = $GLOBALS["strConfigForm_$system_path"];
|
||||
}
|
||||
$htmlOutput .= PMA_displayErrors($name, $error_list);
|
||||
}
|
||||
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverts erroneous fields to their default values
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fixErrors()
|
||||
{
|
||||
$this->_validate();
|
||||
if (count($this->_errors) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cf = $this->_configFile;
|
||||
foreach (array_keys($this->_errors) as $work_path) {
|
||||
if (!isset($this->_systemPaths[$work_path])) {
|
||||
continue;
|
||||
}
|
||||
$canonical_path = $this->_systemPaths[$work_path];
|
||||
$cf->set($work_path, $cf->getDefault($canonical_path));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates select field and casts $value to correct type
|
||||
*
|
||||
* @param string &$value Current value
|
||||
* @param array $allowed List of allowed values
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function _validateSelect(&$value, array $allowed)
|
||||
{
|
||||
$value_cmp = is_bool($value)
|
||||
? (int) $value
|
||||
: $value;
|
||||
foreach ($allowed as $vk => $v) {
|
||||
// equality comparison only if both values are numeric or not numeric
|
||||
// (allows to skip 0 == 'string' equalling to true)
|
||||
// or identity (for string-string)
|
||||
if (($vk == $value && !(is_numeric($value_cmp) xor is_numeric($vk)))
|
||||
|| $vk === $value
|
||||
) {
|
||||
// keep boolean value as boolean
|
||||
if (!is_bool($value)) {
|
||||
settype($value, gettype($vk));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates and saves form data to session
|
||||
*
|
||||
* @param array|string $forms array of form names
|
||||
* @param bool $allow_partial_save allows for partial form saving on
|
||||
* failed validation
|
||||
*
|
||||
* @return boolean true on success (no errors and all saved)
|
||||
*/
|
||||
public function save($forms, $allow_partial_save = true)
|
||||
{
|
||||
$result = true;
|
||||
$forms = (array) $forms;
|
||||
|
||||
$values = array();
|
||||
$to_save = array();
|
||||
$is_setup_script = defined('PMA_SETUP');
|
||||
if ($is_setup_script) {
|
||||
$this->_loadUserprefsInfo();
|
||||
}
|
||||
|
||||
$this->_errors = array();
|
||||
foreach ($forms as $form_name) {
|
||||
/* @var $form Form */
|
||||
if (isset($this->_forms[$form_name])) {
|
||||
$form = $this->_forms[$form_name];
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
// get current server id
|
||||
$change_index = $form->index === 0
|
||||
? $this->_configFile->getServerCount() + 1
|
||||
: false;
|
||||
// grab POST values
|
||||
foreach ($form->fields as $field => $system_path) {
|
||||
$work_path = array_search($system_path, $this->_systemPaths);
|
||||
$key = $this->_translatedPaths[$work_path];
|
||||
$type = $form->getOptionType($field);
|
||||
|
||||
// skip groups
|
||||
if ($type == 'group') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// ensure the value is set
|
||||
if (!isset($_POST[$key])) {
|
||||
// checkboxes aren't set by browsers if they're off
|
||||
if ($type == 'boolean') {
|
||||
$_POST[$key] = false;
|
||||
} else {
|
||||
$this->_errors[$form->name][] = sprintf(
|
||||
__('Missing data for %s'),
|
||||
'<i>' . PMA_langName($system_path) . '</i>'
|
||||
);
|
||||
$result = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// user preferences allow/disallow
|
||||
if ($is_setup_script
|
||||
&& isset($this->_userprefsKeys[$system_path])
|
||||
) {
|
||||
if (isset($this->_userprefsDisallow[$system_path])
|
||||
&& isset($_POST[$key . '-userprefs-allow'])
|
||||
) {
|
||||
unset($this->_userprefsDisallow[$system_path]);
|
||||
} else if (!isset($_POST[$key . '-userprefs-allow'])) {
|
||||
$this->_userprefsDisallow[$system_path] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// cast variables to correct type
|
||||
switch ($type) {
|
||||
case 'double':
|
||||
$_POST[$key] = Util::requestString($_POST[$key]);
|
||||
settype($_POST[$key], 'float');
|
||||
break;
|
||||
case 'boolean':
|
||||
case 'integer':
|
||||
if ($_POST[$key] !== '') {
|
||||
$_POST[$key] = Util::requestString($_POST[$key]);
|
||||
settype($_POST[$key], $type);
|
||||
}
|
||||
break;
|
||||
case 'select':
|
||||
$successfully_validated = $this->_validateSelect(
|
||||
$_POST[$key],
|
||||
$form->getOptionValueList($system_path)
|
||||
);
|
||||
if (! $successfully_validated) {
|
||||
$this->_errors[$work_path][] = __('Incorrect value!');
|
||||
$result = false;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 'string':
|
||||
case 'short_string':
|
||||
$_POST[$key] = Util::requestString($_POST[$key]);
|
||||
break;
|
||||
case 'array':
|
||||
// eliminate empty values and ensure we have an array
|
||||
$post_values = is_array($_POST[$key])
|
||||
? $_POST[$key]
|
||||
: explode("\n", $_POST[$key]);
|
||||
$_POST[$key] = array();
|
||||
$this->_fillPostArrayParameters($post_values, $key);
|
||||
break;
|
||||
}
|
||||
|
||||
// now we have value with proper type
|
||||
$values[$system_path] = $_POST[$key];
|
||||
if ($change_index !== false) {
|
||||
$work_path = str_replace(
|
||||
"Servers/$form->index/",
|
||||
"Servers/$change_index/", $work_path
|
||||
);
|
||||
}
|
||||
$to_save[$work_path] = $system_path;
|
||||
}
|
||||
}
|
||||
|
||||
// save forms
|
||||
if (!$allow_partial_save && !empty($this->_errors)) {
|
||||
// don't look for non-critical errors
|
||||
$this->_validate();
|
||||
return $result;
|
||||
}
|
||||
|
||||
foreach ($to_save as $work_path => $path) {
|
||||
// TrustedProxies requires changes before saving
|
||||
if ($path == 'TrustedProxies') {
|
||||
$proxies = array();
|
||||
$i = 0;
|
||||
foreach ($values[$path] as $value) {
|
||||
$matches = array();
|
||||
$match = preg_match(
|
||||
"/^(.+):(?:[ ]?)(\\w+)$/", $value, $matches
|
||||
);
|
||||
if ($match) {
|
||||
// correct 'IP: HTTP header' pair
|
||||
$ip = trim($matches[1]);
|
||||
$proxies[$ip] = trim($matches[2]);
|
||||
} else {
|
||||
// save also incorrect values
|
||||
$proxies["-$i"] = $value;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$values[$path] = $proxies;
|
||||
}
|
||||
$this->_configFile->set($work_path, $values[$path], $path);
|
||||
}
|
||||
if ($is_setup_script) {
|
||||
$this->_configFile->set(
|
||||
'UserprefsDisallow',
|
||||
array_keys($this->_userprefsDisallow)
|
||||
);
|
||||
}
|
||||
|
||||
// don't look for non-critical errors
|
||||
$this->_validate();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether form validation failed
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasErrors()
|
||||
{
|
||||
return count($this->_errors) > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns link to documentation
|
||||
*
|
||||
* @param string $path Path to documentation
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDocLink($path)
|
||||
{
|
||||
$test = mb_substr($path, 0, 6);
|
||||
if ($test == 'Import' || $test == 'Export') {
|
||||
return '';
|
||||
}
|
||||
return Util::getDocuLink(
|
||||
'config',
|
||||
'cfg_' . $this->_getOptName($path)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes path so it can be used in URLs
|
||||
*
|
||||
* @param string $path Path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getOptName($path)
|
||||
{
|
||||
return str_replace(array('Servers/1/', '/'), array('Servers/', '_'), $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills out {@link userprefs_keys} and {@link userprefs_disallow}
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _loadUserprefsInfo()
|
||||
{
|
||||
if ($this->_userprefsKeys !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_userprefsKeys = array_flip(PMA_readUserprefsFieldNames());
|
||||
// read real config for user preferences display
|
||||
$userprefs_disallow = defined('PMA_SETUP')
|
||||
? $this->_configFile->get('UserprefsDisallow', array())
|
||||
: $GLOBALS['cfg']['UserprefsDisallow'];
|
||||
$this->_userprefsDisallow = array_flip($userprefs_disallow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets field comments and warnings based on current environment
|
||||
*
|
||||
* @param string $system_path Path to settings
|
||||
* @param array &$opts Chosen options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _setComments($system_path, array &$opts)
|
||||
{
|
||||
// RecodingEngine - mark unavailable types
|
||||
if ($system_path == 'RecodingEngine') {
|
||||
$comment = '';
|
||||
if (!function_exists('iconv')) {
|
||||
$opts['values']['iconv'] .= ' (' . __('unavailable') . ')';
|
||||
$comment = sprintf(
|
||||
__('"%s" requires %s extension'), 'iconv', 'iconv'
|
||||
);
|
||||
}
|
||||
if (!function_exists('recode_string')) {
|
||||
$opts['values']['recode'] .= ' (' . __('unavailable') . ')';
|
||||
$comment .= ($comment ? ", " : '') . sprintf(
|
||||
__('"%s" requires %s extension'),
|
||||
'recode', 'recode'
|
||||
);
|
||||
}
|
||||
if (!function_exists('mb_convert_encoding')) {
|
||||
$opts['values']['mb'] .= ' (' . __('unavailable') . ')';
|
||||
$comment .= ($comment ? ", " : '') . sprintf(
|
||||
__('"%s" requires %s extension'),
|
||||
'mb', 'mbstring'
|
||||
);
|
||||
}
|
||||
$opts['comment'] = $comment;
|
||||
$opts['comment_warning'] = true;
|
||||
}
|
||||
// ZipDump, GZipDump, BZipDump - check function availability
|
||||
if ($system_path == 'ZipDump'
|
||||
|| $system_path == 'GZipDump'
|
||||
|| $system_path == 'BZipDump'
|
||||
) {
|
||||
$comment = '';
|
||||
$funcs = array(
|
||||
'ZipDump' => array('zip_open', 'gzcompress'),
|
||||
'GZipDump' => array('gzopen', 'gzencode'),
|
||||
'BZipDump' => array('bzopen', 'bzcompress'));
|
||||
if (!function_exists($funcs[$system_path][0])) {
|
||||
$comment = sprintf(
|
||||
__(
|
||||
'Compressed import will not work due to missing function %s.'
|
||||
),
|
||||
$funcs[$system_path][0]
|
||||
);
|
||||
}
|
||||
if (!function_exists($funcs[$system_path][1])) {
|
||||
$comment .= ($comment ? '; ' : '') . sprintf(
|
||||
__(
|
||||
'Compressed export will not work due to missing function %s.'
|
||||
),
|
||||
$funcs[$system_path][1]
|
||||
);
|
||||
}
|
||||
$opts['comment'] = $comment;
|
||||
$opts['comment_warning'] = true;
|
||||
}
|
||||
if (!defined('PMA_SETUP')) {
|
||||
if (($system_path == 'MaxDbList' || $system_path == 'MaxTableList'
|
||||
|| $system_path == 'QueryHistoryMax')
|
||||
) {
|
||||
$opts['comment'] = sprintf(
|
||||
__('maximum %s'), $GLOBALS['cfg'][$system_path]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy items of an array to $_POST variable
|
||||
*
|
||||
* @param array $post_values List of parameters
|
||||
* @param string $key Array key
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _fillPostArrayParameters($post_values, $key)
|
||||
{
|
||||
foreach ($post_values as $v) {
|
||||
$v = Util::requestString($v);
|
||||
if ($v !== '') {
|
||||
$_POST[$key][] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
526
#pma/libraries/config/FormDisplay.tpl.php
Normal file
526
#pma/libraries/config/FormDisplay.tpl.php
Normal file
@ -0,0 +1,526 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Form templates
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PMA\libraries\Template;
|
||||
use PMA\libraries\Util;
|
||||
|
||||
/**
|
||||
* Displays top part of the form
|
||||
*
|
||||
* @param string $action default: $_SERVER['REQUEST_URI']
|
||||
* @param string $method 'post' or 'get'
|
||||
* @param array $hidden_fields array of form hidden fields (key: field name)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_displayFormTop($action = null, $method = 'post', $hidden_fields = null)
|
||||
{
|
||||
static $has_check_page_refresh = false;
|
||||
|
||||
if ($action === null) {
|
||||
$action = $_SERVER['REQUEST_URI'];
|
||||
}
|
||||
if ($method != 'post') {
|
||||
$method = 'get';
|
||||
}
|
||||
$htmlOutput = '<form method="' . $method . '" action="'
|
||||
. htmlspecialchars($action) . '" class="config-form disableAjax">';
|
||||
$htmlOutput .= '<input type="hidden" name="tab_hash" value="" />';
|
||||
// we do validation on page refresh when browser remembers field values,
|
||||
// add a field with known value which will be used for checks
|
||||
if (! $has_check_page_refresh) {
|
||||
$has_check_page_refresh = true;
|
||||
$htmlOutput .= '<input type="hidden" name="check_page_refresh" '
|
||||
. ' id="check_page_refresh" value="" />' . "\n";
|
||||
}
|
||||
$htmlOutput .= PMA_URL_getHiddenInputs('', '', 0, 'server') . "\n";
|
||||
$htmlOutput .= PMA_getHiddenFields((array)$hidden_fields);
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays form tabs which are given by an array indexed by fieldset id
|
||||
* ({@link PMA_displayFieldsetTop}), with values being tab titles.
|
||||
*
|
||||
* @param array $tabs tab names
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_displayTabsTop($tabs)
|
||||
{
|
||||
$items = array();
|
||||
foreach ($tabs as $tab_id => $tab_name) {
|
||||
$items[] = array(
|
||||
'content' => htmlspecialchars($tab_name),
|
||||
'url' => array(
|
||||
'href' => '#' . $tab_id,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$htmlOutput = Template::get('list/unordered')->render(
|
||||
array(
|
||||
'class' => 'tabs',
|
||||
'items' => $items,
|
||||
)
|
||||
);
|
||||
$htmlOutput .= '<br clear="right" />';
|
||||
$htmlOutput .= '<div class="tabs_contents">';
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays top part of a fieldset
|
||||
*
|
||||
* @param string $title title of fieldset
|
||||
* @param string $description description shown on top of fieldset
|
||||
* @param array $errors error messages to display
|
||||
* @param array $attributes optional extra attributes of fieldset
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_displayFieldsetTop($title = '', $description = '', $errors = null,
|
||||
$attributes = array()
|
||||
) {
|
||||
global $_FormDisplayGroup;
|
||||
|
||||
$_FormDisplayGroup = 0;
|
||||
|
||||
$attributes = array_merge(array('class' => 'optbox'), $attributes);
|
||||
foreach ($attributes as $k => &$attr) {
|
||||
$attr = $k . '="' . htmlspecialchars($attr) . '"';
|
||||
}
|
||||
|
||||
$htmlOutput = '<fieldset ' . implode(' ', $attributes) . '>';
|
||||
$htmlOutput .= '<legend>' . $title . '</legend>';
|
||||
if (!empty($description)) {
|
||||
$htmlOutput .= '<p>' . $description . '</p>';
|
||||
}
|
||||
// this must match with displayErrors() in scripts.js
|
||||
if (is_array($errors) && count($errors) > 0) {
|
||||
$htmlOutput .= '<dl class="errors">';
|
||||
foreach ($errors as $error) {
|
||||
$htmlOutput .= '<dd>' . $error . '</dd>';
|
||||
}
|
||||
$htmlOutput .= '</dl>';
|
||||
}
|
||||
$htmlOutput .= '<table width="100%" cellspacing="0">';
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays input field
|
||||
*
|
||||
* $opts keys:
|
||||
* o doc - (string) documentation link
|
||||
* o errors - error array
|
||||
* o setvalue - (string) shows button allowing to set predefined value
|
||||
* o show_restore_default - (boolean) whether show "restore default" button
|
||||
* o userprefs_allow - whether user preferences are enabled for this field
|
||||
* (null - no support, true/false - enabled/disabled)
|
||||
* o userprefs_comment - (string) field comment
|
||||
* o values - key - value pairs for <select> fields
|
||||
* o values_escaped - (boolean) tells whether values array is already escaped
|
||||
* (defaults to false)
|
||||
* o values_disabled - (array)list of disabled values (keys from values)
|
||||
* o comment - (string) tooltip comment
|
||||
* o comment_warning - (bool) whether this comments warns about something
|
||||
*
|
||||
* @param string $path config option path
|
||||
* @param string $name config option name
|
||||
* @param string $type type of config option
|
||||
* @param mixed $value current value
|
||||
* @param string $description verbose description
|
||||
* @param bool $value_is_default whether value is default
|
||||
* @param array $opts see above description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_displayInput($path, $name, $type, $value, $description = '',
|
||||
$value_is_default = true, $opts = null
|
||||
) {
|
||||
global $_FormDisplayGroup;
|
||||
static $icons; // An array of IMG tags used further below in the function
|
||||
|
||||
if (defined('TESTSUITE')) {
|
||||
$icons = null;
|
||||
}
|
||||
|
||||
$is_setup_script = defined('PMA_SETUP');
|
||||
if ($icons === null) { // if the static variables have not been initialised
|
||||
$icons = array();
|
||||
// Icon definitions:
|
||||
// The same indexes will be used in the $icons array.
|
||||
// The first element contains the filename and the second
|
||||
// element is used for the "alt" and "title" attributes.
|
||||
$icon_init = array(
|
||||
'edit' => array('b_edit.png', ''),
|
||||
'help' => array('b_help.png', __('Documentation')),
|
||||
'reload' => array('s_reload.png', ''),
|
||||
'tblops' => array('b_tblops.png', '')
|
||||
);
|
||||
if ($is_setup_script) {
|
||||
// When called from the setup script, we don't have access to the
|
||||
// sprite-aware getImage() function because the PMA_theme class
|
||||
// has not been loaded, so we generate the img tags manually.
|
||||
foreach ($icon_init as $k => $v) {
|
||||
$title = '';
|
||||
if (! empty($v[1])) {
|
||||
$title = ' title="' . $v[1] . '"';
|
||||
}
|
||||
$icons[$k] = sprintf(
|
||||
'<img alt="%s" src="%s"%s />',
|
||||
$v[1],
|
||||
".{$GLOBALS['cfg']['ThemePath']}/original/img/{$v[0]}",
|
||||
$title
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// In this case we just use getImage() because it's available
|
||||
foreach ($icon_init as $k => $v) {
|
||||
$icons[$k] = Util::getImage(
|
||||
$v[0], $v[1]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$has_errors = isset($opts['errors']) && !empty($opts['errors']);
|
||||
$option_is_disabled = ! $is_setup_script && isset($opts['userprefs_allow'])
|
||||
&& ! $opts['userprefs_allow'];
|
||||
$name_id = 'name="' . htmlspecialchars($path) . '" id="'
|
||||
. htmlspecialchars($path) . '"';
|
||||
$field_class = $type == 'checkbox' ? 'checkbox' : '';
|
||||
if (! $value_is_default) {
|
||||
$field_class .= ($field_class == '' ? '' : ' ')
|
||||
. ($has_errors ? 'custom field-error' : 'custom');
|
||||
}
|
||||
$field_class = $field_class ? ' class="' . $field_class . '"' : '';
|
||||
$tr_class = $_FormDisplayGroup > 0
|
||||
? 'group-field group-field-' . $_FormDisplayGroup
|
||||
: '';
|
||||
if (isset($opts['setvalue']) && $opts['setvalue'] == ':group') {
|
||||
unset($opts['setvalue']);
|
||||
$_FormDisplayGroup++;
|
||||
$tr_class = 'group-header-field group-header-' . $_FormDisplayGroup;
|
||||
}
|
||||
if ($option_is_disabled) {
|
||||
$tr_class .= ($tr_class ? ' ' : '') . 'disabled-field';
|
||||
}
|
||||
$tr_class = $tr_class ? ' class="' . $tr_class . '"' : '';
|
||||
|
||||
$htmlOutput = '<tr' . $tr_class . '>';
|
||||
$htmlOutput .= '<th>';
|
||||
$htmlOutput .= '<label for="' . htmlspecialchars($path) . '">' . $name
|
||||
. '</label>';
|
||||
|
||||
if (! empty($opts['doc'])) {
|
||||
$htmlOutput .= '<span class="doc">';
|
||||
$htmlOutput .= '<a href="' . $opts['doc']
|
||||
. '" target="documentation">' . $icons['help'] . '</a>';
|
||||
$htmlOutput .= "\n";
|
||||
$htmlOutput .= '</span>';
|
||||
}
|
||||
|
||||
if ($option_is_disabled) {
|
||||
$htmlOutput .= '<span class="disabled-notice" title="';
|
||||
$htmlOutput .= __(
|
||||
'This setting is disabled, it will not be applied to your configuration.'
|
||||
);
|
||||
$htmlOutput .= '">' . __('Disabled') . "</span>";
|
||||
}
|
||||
|
||||
if (!empty($description)) {
|
||||
$htmlOutput .= '<small>' . $description . '</small>';
|
||||
}
|
||||
|
||||
$htmlOutput .= '</th>';
|
||||
$htmlOutput .= '<td>';
|
||||
|
||||
switch ($type) {
|
||||
case 'text':
|
||||
$htmlOutput .= '<input type="text" size="40" ' . $name_id . $field_class
|
||||
. ' value="' . htmlspecialchars($value) . '" />';
|
||||
break;
|
||||
case 'password':
|
||||
$htmlOutput .= '<input type="password" size="40" ' . $name_id . $field_class
|
||||
. ' value="' . htmlspecialchars($value) . '" />';
|
||||
break;
|
||||
case 'short_text':
|
||||
// As seen in the reporting server (#15042) we sometimes receive
|
||||
// an array here. No clue about its origin nor content, so let's avoid
|
||||
// a notice on htmlspecialchars().
|
||||
if (! is_array($value)) {
|
||||
$htmlOutput .= '<input type="text" size="25" ' . $name_id
|
||||
. $field_class . ' value="' . htmlspecialchars($value)
|
||||
. '" />';
|
||||
}
|
||||
break;
|
||||
case 'number_text':
|
||||
$htmlOutput .= '<input type="number" ' . $name_id . $field_class
|
||||
. ' value="' . htmlspecialchars($value) . '" />';
|
||||
break;
|
||||
case 'checkbox':
|
||||
$htmlOutput .= '<span' . $field_class . '><input type="checkbox" ' . $name_id
|
||||
. ($value ? ' checked="checked"' : '') . ' /></span>';
|
||||
break;
|
||||
case 'select':
|
||||
$htmlOutput .= '<select ' . $name_id . $field_class . '>';
|
||||
$escape = !(isset($opts['values_escaped']) && $opts['values_escaped']);
|
||||
$values_disabled = isset($opts['values_disabled'])
|
||||
? array_flip($opts['values_disabled']) : array();
|
||||
foreach ($opts['values'] as $opt_value_key => $opt_value) {
|
||||
// set names for boolean values
|
||||
if (is_bool($opt_value)) {
|
||||
$opt_value = mb_strtolower(
|
||||
$opt_value ? __('Yes') : __('No')
|
||||
);
|
||||
}
|
||||
// escape if necessary
|
||||
if ($escape) {
|
||||
$display = htmlspecialchars($opt_value);
|
||||
$display_value = htmlspecialchars($opt_value_key);
|
||||
} else {
|
||||
$display = $opt_value;
|
||||
$display_value = $opt_value_key;
|
||||
}
|
||||
// compare with selected value
|
||||
// boolean values are cast to integers when used as array keys
|
||||
$selected = is_bool($value)
|
||||
? (int) $value === $opt_value_key
|
||||
: $opt_value_key === $value;
|
||||
$htmlOutput .= '<option value="' . $display_value . '"';
|
||||
if ($selected) {
|
||||
$htmlOutput .= ' selected="selected"';
|
||||
}
|
||||
if (isset($values_disabled[$opt_value_key])) {
|
||||
$htmlOutput .= ' disabled="disabled"';
|
||||
}
|
||||
$htmlOutput .= '>' . $display . '</option>';
|
||||
}
|
||||
$htmlOutput .= '</select>';
|
||||
break;
|
||||
case 'list':
|
||||
$htmlOutput .= '<textarea cols="40" rows="5" ' . $name_id . $field_class
|
||||
. '>' . htmlspecialchars(implode("\n", $value)) . '</textarea>';
|
||||
break;
|
||||
}
|
||||
if (isset($opts['comment']) && $opts['comment']) {
|
||||
$class = 'field-comment-mark';
|
||||
if (isset($opts['comment_warning']) && $opts['comment_warning']) {
|
||||
$class .= ' field-comment-warning';
|
||||
}
|
||||
$htmlOutput .= '<span class="' . $class . '" title="'
|
||||
. htmlspecialchars($opts['comment']) . '">i</span>';
|
||||
}
|
||||
if ($is_setup_script
|
||||
&& isset($opts['userprefs_comment'])
|
||||
&& $opts['userprefs_comment']
|
||||
) {
|
||||
$htmlOutput .= '<a class="userprefs-comment" title="'
|
||||
. htmlspecialchars($opts['userprefs_comment']) . '">'
|
||||
. $icons['tblops'] . '</a>';
|
||||
}
|
||||
if (isset($opts['setvalue']) && $opts['setvalue']) {
|
||||
$htmlOutput .= '<a class="set-value" href="#'
|
||||
. htmlspecialchars("$path={$opts['setvalue']}") . '" title="'
|
||||
. sprintf(__('Set value: %s'), htmlspecialchars($opts['setvalue']))
|
||||
. '" style="display:none">' . $icons['edit'] . '</a>';
|
||||
}
|
||||
if (isset($opts['show_restore_default']) && $opts['show_restore_default']) {
|
||||
$htmlOutput .= '<a class="restore-default" href="#' . $path . '" title="'
|
||||
. __('Restore default value') . '" style="display:none">'
|
||||
. $icons['reload'] . '</a>';
|
||||
}
|
||||
// this must match with displayErrors() in scripts/config.js
|
||||
if ($has_errors) {
|
||||
$htmlOutput .= "\n <dl class=\"inline_errors\">";
|
||||
foreach ($opts['errors'] as $error) {
|
||||
$htmlOutput .= '<dd>' . htmlspecialchars($error) . '</dd>';
|
||||
}
|
||||
$htmlOutput .= '</dl>';
|
||||
}
|
||||
$htmlOutput .= '</td>';
|
||||
if ($is_setup_script && isset($opts['userprefs_allow'])) {
|
||||
$htmlOutput .= '<td class="userprefs-allow" title="' .
|
||||
__('Allow users to customize this value') . '">';
|
||||
$htmlOutput .= '<input type="checkbox" name="' . $path
|
||||
. '-userprefs-allow" ';
|
||||
if ($opts['userprefs_allow']) {
|
||||
$htmlOutput .= 'checked="checked"';
|
||||
};
|
||||
$htmlOutput .= '/>';
|
||||
$htmlOutput .= '</td>';
|
||||
} else if ($is_setup_script) {
|
||||
$htmlOutput .= '<td> </td>';
|
||||
}
|
||||
$htmlOutput .= '</tr>';
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display group header
|
||||
*
|
||||
* @param string $header_text Text of header
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
function PMA_displayGroupHeader($header_text)
|
||||
{
|
||||
global $_FormDisplayGroup;
|
||||
|
||||
$_FormDisplayGroup++;
|
||||
if (! $header_text) {
|
||||
return null;
|
||||
}
|
||||
$colspan = defined('PMA_SETUP')
|
||||
? 3
|
||||
: 2;
|
||||
$htmlOutput = '<tr class="group-header group-header-' . $_FormDisplayGroup
|
||||
. '">';
|
||||
$htmlOutput .= '<th colspan="' . $colspan . '">';
|
||||
$htmlOutput .= $header_text;
|
||||
$htmlOutput .= '</th>';
|
||||
$htmlOutput .= '</tr>';
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display group footer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_displayGroupFooter()
|
||||
{
|
||||
global $_FormDisplayGroup;
|
||||
|
||||
$_FormDisplayGroup--;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays bottom part of a fieldset
|
||||
*
|
||||
* @param bool $show_buttons whether show submit and reset button
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_displayFieldsetBottom($show_buttons = true)
|
||||
{
|
||||
$colspan = 2;
|
||||
if (defined('PMA_SETUP')) {
|
||||
$colspan++;
|
||||
}
|
||||
$htmlOutput = '';
|
||||
if ($show_buttons) {
|
||||
$htmlOutput .= '<tr>';
|
||||
$htmlOutput .= '<td colspan="' . $colspan . '" class="lastrow">';
|
||||
$htmlOutput .= '<input type="submit" name="submit_save" value="'
|
||||
. __('Apply') . '" class="green" />';
|
||||
$htmlOutput .= '<input type="button" name="submit_reset" value="'
|
||||
. __('Reset') . '" />';
|
||||
$htmlOutput .= '</td>';
|
||||
$htmlOutput .= '</tr>';
|
||||
}
|
||||
$htmlOutput .= '</table>';
|
||||
$htmlOutput .= '</fieldset>';
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays simple bottom part of a fieldset (without submit buttons)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_displayFieldsetBottomSimple()
|
||||
{
|
||||
$htmlOutput = '</table>';
|
||||
$htmlOutput .= '</fieldset>';
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes form tabs
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_displayTabsBottom()
|
||||
{
|
||||
$htmlOutput = "</div>\n";
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays bottom part of the form
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_displayFormBottom()
|
||||
{
|
||||
$htmlOutput = "</form>\n";
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends JS validation code to $js_array
|
||||
*
|
||||
* @param string $field_id ID of field to validate
|
||||
* @param string|array $validators validators callback
|
||||
* @param array &$js_array will be updated with javascript code
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_addJsValidate($field_id, $validators, &$js_array)
|
||||
{
|
||||
foreach ((array)$validators as $validator) {
|
||||
$validator = (array)$validator;
|
||||
$v_name = array_shift($validator);
|
||||
$v_name = "PMA_" . $v_name;
|
||||
$v_args = array();
|
||||
foreach ($validator as $arg) {
|
||||
$v_args[] = PMA_escapeJsString($arg);
|
||||
}
|
||||
$v_args = $v_args ? ", ['" . implode("', '", $v_args) . "']" : '';
|
||||
$js_array[] = "validateField('$field_id', '$v_name', true$v_args)";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays JavaScript code
|
||||
*
|
||||
* @param array $js_array lines of javascript code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_displayJavascript($js_array)
|
||||
{
|
||||
if (empty($js_array)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Template::get('javascript/display')->render(
|
||||
array('js_array' => $js_array,)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays error list
|
||||
*
|
||||
* @param string $name name of item with errors
|
||||
* @param array $error_list list of errors to show
|
||||
*
|
||||
* @return string HTML for errors
|
||||
*/
|
||||
function PMA_displayErrors($name, $error_list)
|
||||
{
|
||||
$htmlOutput = '<dl>';
|
||||
$htmlOutput .= '<dt>' . htmlspecialchars($name) . '</dt>';
|
||||
foreach ($error_list as $error) {
|
||||
$htmlOutput .= '<dd>' . htmlspecialchars($error) . '</dd>';
|
||||
}
|
||||
$htmlOutput .= '</dl>';
|
||||
return $htmlOutput;
|
||||
}
|
231
#pma/libraries/config/PageSettings.php
Normal file
231
#pma/libraries/config/PageSettings.php
Normal file
@ -0,0 +1,231 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Page-related settings
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
namespace PMA\libraries\config;
|
||||
|
||||
use PMA\libraries\Message;
|
||||
use PMA\libraries\Response;
|
||||
|
||||
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';
|
||||
require 'libraries/config/page_settings.forms.php';
|
||||
|
||||
/**
|
||||
* Page-related settings
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class PageSettings
|
||||
{
|
||||
|
||||
/**
|
||||
* Contains id of the form element
|
||||
* @var string
|
||||
*/
|
||||
private $_elemId = 'page_settings_modal';
|
||||
|
||||
/**
|
||||
* Name of the group to show
|
||||
* @var string
|
||||
*/
|
||||
private $_groupName = '';
|
||||
|
||||
/**
|
||||
* Contains HTML of errors
|
||||
* @var string
|
||||
*/
|
||||
private $_errorHTML = '';
|
||||
|
||||
/**
|
||||
* Contains HTML of settings
|
||||
* @var string
|
||||
*/
|
||||
private $_HTML = '';
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process response to form
|
||||
*
|
||||
* @param FormDisplay &$form_display Form
|
||||
* @param ConfigFile &$cf Configuration file
|
||||
* @param Message|null &$error Error message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _processPageSettings(&$form_display, &$cf, &$error)
|
||||
{
|
||||
if ($form_display->process(false) && !$form_display->hasErrors()) {
|
||||
// save settings
|
||||
$result = PMA_saveUserprefs($cf->getConfigArray());
|
||||
if ($result === true) {
|
||||
// reload page
|
||||
header('Location: ' . $_SERVER['REQUEST_URI']);
|
||||
exit();
|
||||
} else {
|
||||
$error = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store errors in _errorHTML
|
||||
*
|
||||
* @param FormDisplay &$form_display Form
|
||||
* @param Message|null &$error Error message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _storeError(&$form_display, &$error)
|
||||
{
|
||||
$retval = '';
|
||||
if ($error) {
|
||||
$retval .= $error->getDisplay();
|
||||
}
|
||||
if ($form_display->hasErrors()) {
|
||||
// form has errors
|
||||
$retval .= '<div class="error config-form">'
|
||||
. '<b>' . __(
|
||||
'Cannot save settings, submitted configuration form contains '
|
||||
. 'errors!'
|
||||
) . '</b>'
|
||||
. $form_display->displayErrors()
|
||||
. '</div>';
|
||||
}
|
||||
$this->_errorHTML = $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display page-related settings
|
||||
*
|
||||
* @param FormDisplay &$form_display Form
|
||||
* @param Message &$error Error message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getPageSettingsDisplay(&$form_display, &$error)
|
||||
{
|
||||
$response = Response::getInstance();
|
||||
|
||||
$retval = '';
|
||||
|
||||
$this->_storeError($form_display, $error);
|
||||
|
||||
$retval .= '<div id="' . $this->_elemId . '">';
|
||||
$retval .= '<div class="page_settings">';
|
||||
$retval .= $form_display->getDisplay(
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
$response->getFooter()->getSelfUrl('unencoded'),
|
||||
array(
|
||||
'submit_save' => $this->_groupName
|
||||
)
|
||||
);
|
||||
$retval .= '</div>';
|
||||
$retval .= '</div>';
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML output
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHTML()
|
||||
{
|
||||
return $this->_HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get error HTML output
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorHTML()
|
||||
{
|
||||
return $this->_errorHTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Group to show for Page-related settings
|
||||
* @param string $formGroupName The name of config form group to display
|
||||
* @return PageSettings
|
||||
*/
|
||||
public static function showGroup($formGroupName)
|
||||
{
|
||||
$object = new PageSettings($formGroupName);
|
||||
|
||||
$response = Response::getInstance();
|
||||
$response->addHTML($object->getErrorHTML());
|
||||
$response->addHTML($object->getHTML());
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML for navigation settings
|
||||
* @return string
|
||||
*/
|
||||
public static function getNaviSettings()
|
||||
{
|
||||
$object = new PageSettings('Navi_panel', 'pma_navigation_settings');
|
||||
|
||||
$response = Response::getInstance();
|
||||
$response->addHTML($object->getErrorHTML());
|
||||
return $object->getHTML();
|
||||
}
|
||||
}
|
646
#pma/libraries/config/ServerConfigChecks.php
Normal file
646
#pma/libraries/config/ServerConfigChecks.php
Normal file
@ -0,0 +1,646 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Server config checks management
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
namespace PMA\libraries\config;
|
||||
|
||||
/**
|
||||
* Performs various compatibility, security and consistency checks on current config
|
||||
*
|
||||
* Outputs results to message list, must be called between PMA_messagesBegin()
|
||||
* and PMA_messagesEnd()
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class ServerConfigChecks
|
||||
{
|
||||
/**
|
||||
* @var ConfigFile configurations being checked
|
||||
*/
|
||||
protected $cfg;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ConfigFile $cfg Configuration
|
||||
*/
|
||||
public function __construct(ConfigFile $cfg)
|
||||
{
|
||||
$this->cfg = $cfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform config checks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function performConfigChecks()
|
||||
{
|
||||
$blowfishSecret = $this->cfg->get('blowfish_secret');
|
||||
$blowfishSecretSet = false;
|
||||
$cookieAuthUsed = false;
|
||||
|
||||
list(
|
||||
$sAllowArbitraryServerWarn, $sBlowfishSecretMsg,
|
||||
$sBZipDumpWarn, $sDirectoryNotice,
|
||||
$sGZipDumpWarn, $sLoginCookieValidityWarn,
|
||||
$sLoginCookieValidityWarn2, $sLoginCookieValidityWarn3,
|
||||
$sSecurityInfoMsg, $sSrvAuthCfgMsg, $sZipDumpExportWarn,
|
||||
$sZipDumpImportWarn
|
||||
) = self::defineMessages();
|
||||
|
||||
list($cookieAuthUsed, $blowfishSecret, $blowfishSecretSet)
|
||||
= $this->performConfigChecksServers(
|
||||
$cookieAuthUsed, $blowfishSecret, $sSrvAuthCfgMsg,
|
||||
$sSecurityInfoMsg, $blowfishSecretSet
|
||||
);
|
||||
|
||||
$this->performConfigChecksCookieAuthUsed(
|
||||
$cookieAuthUsed, $blowfishSecretSet, $sBlowfishSecretMsg,
|
||||
$blowfishSecret
|
||||
);
|
||||
|
||||
//
|
||||
// $cfg['AllowArbitraryServer']
|
||||
// should be disabled
|
||||
//
|
||||
if ($this->cfg->getValue('AllowArbitraryServer')) {
|
||||
PMA_messagesSet(
|
||||
'notice',
|
||||
'AllowArbitraryServer',
|
||||
PMA_lang(PMA_langName('AllowArbitraryServer')),
|
||||
PMA_lang($sAllowArbitraryServerWarn)
|
||||
);
|
||||
}
|
||||
|
||||
$this->performConfigChecksLoginCookie(
|
||||
$sLoginCookieValidityWarn, $sLoginCookieValidityWarn2,
|
||||
$sLoginCookieValidityWarn3
|
||||
);
|
||||
|
||||
//
|
||||
// $cfg['SaveDir']
|
||||
// should not be world-accessible
|
||||
//
|
||||
if ($this->cfg->getValue('SaveDir') != '') {
|
||||
PMA_messagesSet(
|
||||
'notice',
|
||||
'SaveDir',
|
||||
PMA_lang(PMA_langName('SaveDir')),
|
||||
PMA_lang($sDirectoryNotice)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// $cfg['TempDir']
|
||||
// should not be world-accessible
|
||||
//
|
||||
if ($this->cfg->getValue('TempDir') != '') {
|
||||
PMA_messagesSet(
|
||||
'notice',
|
||||
'TempDir',
|
||||
PMA_lang(PMA_langName('TempDir')),
|
||||
PMA_lang($sDirectoryNotice)
|
||||
);
|
||||
}
|
||||
|
||||
$this->performConfigChecksZips(
|
||||
$sGZipDumpWarn, $sBZipDumpWarn, $sZipDumpImportWarn,
|
||||
$sZipDumpExportWarn
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check config of servers
|
||||
*
|
||||
* @param boolean $cookieAuthUsed Cookie auth is used
|
||||
* @param string $blowfishSecret Blowfish secret
|
||||
* @param string $sServerAuthCfgMsg Message for server auth config
|
||||
* @param string $sSecurityInfoMsg Message for security information
|
||||
* @param boolean $blowfishSecretSet Blowfish secret set
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function performConfigChecksServers(
|
||||
$cookieAuthUsed, $blowfishSecret, $sServerAuthCfgMsg,
|
||||
$sSecurityInfoMsg, $blowfishSecretSet
|
||||
) {
|
||||
$serverCnt = $this->cfg->getServerCount();
|
||||
for ($i = 1; $i <= $serverCnt; $i++) {
|
||||
$cookieAuthServer
|
||||
= ($this->cfg->getValue("Servers/$i/auth_type") == 'cookie');
|
||||
$cookieAuthUsed |= $cookieAuthServer;
|
||||
$serverName = $this->performConfigChecksServersGetServerName(
|
||||
$this->cfg->getServerName($i), $i
|
||||
);
|
||||
$serverName = htmlspecialchars($serverName);
|
||||
|
||||
list($blowfishSecret, $blowfishSecretSet)
|
||||
= $this->performConfigChecksServersSetBlowfishSecret(
|
||||
$blowfishSecret, $cookieAuthServer, $blowfishSecretSet
|
||||
);
|
||||
|
||||
//
|
||||
// $cfg['Servers'][$i]['ssl']
|
||||
// should be enabled if possible
|
||||
//
|
||||
if (!$this->cfg->getValue("Servers/$i/ssl")) {
|
||||
$title = PMA_lang(PMA_langName('Servers/1/ssl')) . " ($serverName)";
|
||||
PMA_messagesSet(
|
||||
'notice',
|
||||
"Servers/$i/ssl",
|
||||
$title,
|
||||
__(
|
||||
'You should use SSL connections if your database server '
|
||||
. 'supports it.'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// $cfg['Servers'][$i]['auth_type']
|
||||
// warn about full user credentials if 'auth_type' is 'config'
|
||||
//
|
||||
if ($this->cfg->getValue("Servers/$i/auth_type") == 'config'
|
||||
&& $this->cfg->getValue("Servers/$i/user") != ''
|
||||
&& $this->cfg->getValue("Servers/$i/password") != ''
|
||||
) {
|
||||
$title = PMA_lang(PMA_langName('Servers/1/auth_type'))
|
||||
. " ($serverName)";
|
||||
PMA_messagesSet(
|
||||
'notice',
|
||||
"Servers/$i/auth_type",
|
||||
$title,
|
||||
PMA_lang($sServerAuthCfgMsg, $i) . ' '
|
||||
. PMA_lang($sSecurityInfoMsg, $i)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// $cfg['Servers'][$i]['AllowRoot']
|
||||
// $cfg['Servers'][$i]['AllowNoPassword']
|
||||
// serious security flaw
|
||||
//
|
||||
if ($this->cfg->getValue("Servers/$i/AllowRoot")
|
||||
&& $this->cfg->getValue("Servers/$i/AllowNoPassword")
|
||||
) {
|
||||
$title = PMA_lang(PMA_langName('Servers/1/AllowNoPassword'))
|
||||
. " ($serverName)";
|
||||
PMA_messagesSet(
|
||||
'notice',
|
||||
"Servers/$i/AllowNoPassword",
|
||||
$title,
|
||||
__('You allow for connecting to the server without a password.')
|
||||
. ' ' . PMA_lang($sSecurityInfoMsg, $i)
|
||||
);
|
||||
}
|
||||
}
|
||||
return array($cookieAuthUsed, $blowfishSecret, $blowfishSecretSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set blowfish secret
|
||||
*
|
||||
* @param string $blowfishSecret Blowfish secret
|
||||
* @param boolean $cookieAuthServer Cookie auth is used
|
||||
* @param boolean $blowfishSecretSet Blowfish secret set
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function performConfigChecksServersSetBlowfishSecret(
|
||||
$blowfishSecret, $cookieAuthServer, $blowfishSecretSet
|
||||
) {
|
||||
if ($cookieAuthServer && $blowfishSecret === null) {
|
||||
$blowfishSecret = '';
|
||||
if (! function_exists('openssl_random_pseudo_bytes')) {
|
||||
$random_func = 'phpseclib\\Crypt\\Random::string';
|
||||
} else {
|
||||
$random_func = 'openssl_random_pseudo_bytes';
|
||||
}
|
||||
while (strlen($blowfishSecret) < 32) {
|
||||
$byte = $random_func(1);
|
||||
// We want only ASCII chars
|
||||
if (ord($byte) > 32 && ord($byte) < 127) {
|
||||
$blowfishSecret .= $byte;
|
||||
}
|
||||
}
|
||||
|
||||
$blowfishSecretSet = true;
|
||||
$this->cfg->set('blowfish_secret', $blowfishSecret);
|
||||
}
|
||||
return array($blowfishSecret, $blowfishSecretSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define server name
|
||||
*
|
||||
* @param string $serverName Server name
|
||||
* @param int $serverId Server id
|
||||
*
|
||||
* @return string Server name
|
||||
*/
|
||||
protected function performConfigChecksServersGetServerName(
|
||||
$serverName, $serverId
|
||||
) {
|
||||
if ($serverName == 'localhost') {
|
||||
$serverName .= " [$serverId]";
|
||||
return $serverName;
|
||||
}
|
||||
return $serverName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform config checks for zip part.
|
||||
*
|
||||
* @param string $sGZipDumpWarning Gzip dump warning
|
||||
* @param string $sBZipDumpWarning Bzip dump warning
|
||||
* @param string $sZipDumpImportWarn Zip dump import warning
|
||||
* @param string $sZipDumpExportWarn Zip dump export warning
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function performConfigChecksZips(
|
||||
$sGZipDumpWarning, $sBZipDumpWarning, $sZipDumpImportWarn,
|
||||
$sZipDumpExportWarn
|
||||
) {
|
||||
$this->performConfigChecksServerGZipdump($sGZipDumpWarning);
|
||||
$this->performConfigChecksServerBZipdump($sBZipDumpWarning);
|
||||
$this->performConfigChecksServersZipdump(
|
||||
$sZipDumpImportWarn, $sZipDumpExportWarn
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform config checks for zip part.
|
||||
*
|
||||
* @param string $sZipDumpImportWarn Zip dump import warning
|
||||
* @param string $sZipDumpExportWarn Zip dump export warning
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function performConfigChecksServersZipdump(
|
||||
$sZipDumpImportWarn, $sZipDumpExportWarn
|
||||
) {
|
||||
//
|
||||
// $cfg['ZipDump']
|
||||
// requires zip_open in import
|
||||
//
|
||||
if ($this->cfg->getValue('ZipDump') && !@function_exists('zip_open')) {
|
||||
PMA_messagesSet(
|
||||
'error',
|
||||
'ZipDump_import',
|
||||
PMA_lang(PMA_langName('ZipDump')),
|
||||
PMA_lang($sZipDumpImportWarn, 'zip_open')
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// $cfg['ZipDump']
|
||||
// requires gzcompress in export
|
||||
//
|
||||
if ($this->cfg->getValue('ZipDump') && !@function_exists('gzcompress')) {
|
||||
PMA_messagesSet(
|
||||
'error',
|
||||
'ZipDump_export',
|
||||
PMA_lang(PMA_langName('ZipDump')),
|
||||
PMA_lang($sZipDumpExportWarn, 'gzcompress')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check config of servers
|
||||
*
|
||||
* @param boolean $cookieAuthUsed Cookie auth is used
|
||||
* @param boolean $blowfishSecretSet Blowfish secret set
|
||||
* @param string $sBlowfishSecretMsg Blowfish secret message
|
||||
* @param string $blowfishSecret Blowfish secret
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function performConfigChecksCookieAuthUsed(
|
||||
$cookieAuthUsed, $blowfishSecretSet, $sBlowfishSecretMsg,
|
||||
$blowfishSecret
|
||||
) {
|
||||
//
|
||||
// $cfg['blowfish_secret']
|
||||
// it's required for 'cookie' authentication
|
||||
//
|
||||
if ($cookieAuthUsed) {
|
||||
if ($blowfishSecretSet) {
|
||||
// 'cookie' auth used, blowfish_secret was generated
|
||||
PMA_messagesSet(
|
||||
'notice',
|
||||
'blowfish_secret_created',
|
||||
PMA_lang(PMA_langName('blowfish_secret')),
|
||||
PMA_lang($sBlowfishSecretMsg)
|
||||
);
|
||||
} else {
|
||||
$blowfishWarnings = array();
|
||||
// check length
|
||||
if (strlen($blowfishSecret) < 32) {
|
||||
// too short key
|
||||
$blowfishWarnings[] = __(
|
||||
'Key is too short, it should have at least 32 characters.'
|
||||
);
|
||||
}
|
||||
// check used characters
|
||||
$hasDigits = (bool)preg_match('/\d/', $blowfishSecret);
|
||||
$hasChars = (bool)preg_match('/\S/', $blowfishSecret);
|
||||
$hasNonword = (bool)preg_match('/\W/', $blowfishSecret);
|
||||
if (!$hasDigits || !$hasChars || !$hasNonword) {
|
||||
$blowfishWarnings[] = PMA_lang(
|
||||
__(
|
||||
'Key should contain letters, numbers [em]and[/em] '
|
||||
. 'special characters.'
|
||||
)
|
||||
);
|
||||
}
|
||||
if (!empty($blowfishWarnings)) {
|
||||
PMA_messagesSet(
|
||||
'error',
|
||||
'blowfish_warnings' . count($blowfishWarnings),
|
||||
PMA_lang(PMA_langName('blowfish_secret')),
|
||||
implode('<br />', $blowfishWarnings)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define all messages
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function defineMessages()
|
||||
{
|
||||
$sAllowArbitraryServerWarn = __(
|
||||
'This %soption%s should be disabled as it allows attackers to '
|
||||
. 'bruteforce login to any MySQL server. If you feel this is necessary, '
|
||||
. 'use %srestrict login to MySQL server%s or %strusted proxies list%s. '
|
||||
. 'However, IP-based protection with trusted proxies list may not be '
|
||||
. 'reliable if your IP belongs to an ISP where thousands of users, '
|
||||
. 'including you, are connected to.'
|
||||
);
|
||||
$sAllowArbitraryServerWarn = sprintf(
|
||||
$sAllowArbitraryServerWarn,
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Security]',
|
||||
'[/a]',
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Security]',
|
||||
'[/a]',
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Security]',
|
||||
'[/a]'
|
||||
);
|
||||
$sBlowfishSecretMsg = __(
|
||||
'You didn\'t have blowfish secret set and have enabled '
|
||||
. '[kbd]cookie[/kbd] authentication, so a key was automatically '
|
||||
. 'generated for you. It is used to encrypt cookies; you don\'t need to '
|
||||
. 'remember it.'
|
||||
);
|
||||
$sBZipDumpWarning = __(
|
||||
'%sBzip2 compression and decompression%s requires functions (%s) which '
|
||||
. 'are unavailable on this system.'
|
||||
);
|
||||
$sBZipDumpWarning = sprintf(
|
||||
$sBZipDumpWarning,
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Import_export]',
|
||||
'[/a]', '%s'
|
||||
);
|
||||
$sDirectoryNotice = __(
|
||||
'This value should be double checked to ensure that this directory is '
|
||||
. 'neither world accessible nor readable or writable by other users on '
|
||||
. 'your server.'
|
||||
);
|
||||
$sGZipDumpWarning = __(
|
||||
'%sGZip compression and decompression%s requires functions (%s) which '
|
||||
. 'are unavailable on this system.'
|
||||
);
|
||||
$sGZipDumpWarning = sprintf(
|
||||
$sGZipDumpWarning,
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Import_export]',
|
||||
'[/a]',
|
||||
'%s'
|
||||
);
|
||||
$sLoginCookieValidityWarn = __(
|
||||
'%sLogin cookie validity%s greater than %ssession.gc_maxlifetime%s may '
|
||||
. 'cause random session invalidation (currently session.gc_maxlifetime '
|
||||
. 'is %d).'
|
||||
);
|
||||
$sLoginCookieValidityWarn = sprintf(
|
||||
$sLoginCookieValidityWarn,
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Security]',
|
||||
'[/a]',
|
||||
'[a@' . PMA_getPHPDocLink(
|
||||
'session.configuration.php#ini.session.gc-maxlifetime'
|
||||
) . ']',
|
||||
'[/a]',
|
||||
ini_get('session.gc_maxlifetime')
|
||||
);
|
||||
$sLoginCookieValidityWarn2 = __(
|
||||
'%sLogin cookie validity%s should be set to 1800 seconds (30 minutes) '
|
||||
. 'at most. Values larger than 1800 may pose a security risk such as '
|
||||
. 'impersonation.'
|
||||
);
|
||||
$sLoginCookieValidityWarn2 = sprintf(
|
||||
$sLoginCookieValidityWarn2,
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Security]',
|
||||
'[/a]'
|
||||
);
|
||||
$sLoginCookieValidityWarn3 = __(
|
||||
'If using [kbd]cookie[/kbd] authentication and %sLogin cookie store%s '
|
||||
. 'is not 0, %sLogin cookie validity%s must be set to a value less or '
|
||||
. 'equal to it.'
|
||||
);
|
||||
$sLoginCookieValidityWarn3 = sprintf(
|
||||
$sLoginCookieValidityWarn3,
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Security]',
|
||||
'[/a]',
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Security]',
|
||||
'[/a]'
|
||||
);
|
||||
$sSecurityInfoMsg = __(
|
||||
'If you feel this is necessary, use additional protection settings - '
|
||||
. '%shost authentication%s settings and %strusted proxies list%s. '
|
||||
. 'However, IP-based protection may not be reliable if your IP belongs '
|
||||
. 'to an ISP where thousands of users, including you, are connected to.'
|
||||
);
|
||||
$sSecurityInfoMsg = sprintf(
|
||||
$sSecurityInfoMsg,
|
||||
'[a@?page=servers' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&mode=edit&id=%1$d#tab_Server_config]',
|
||||
'[/a]',
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Security]',
|
||||
'[/a]'
|
||||
);
|
||||
$sServerAuthConfigMsg = __(
|
||||
'You set the [kbd]config[/kbd] authentication type and included '
|
||||
. 'username and password for auto-login, which is not a desirable '
|
||||
. 'option for live hosts. Anyone who knows or guesses your phpMyAdmin '
|
||||
. 'URL can directly access your phpMyAdmin panel. Set %sauthentication '
|
||||
. 'type%s to [kbd]cookie[/kbd] or [kbd]http[/kbd].'
|
||||
);
|
||||
$sServerAuthConfigMsg = sprintf(
|
||||
$sServerAuthConfigMsg,
|
||||
'[a@?page=servers' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&mode=edit&id=%1$d#tab_Server]',
|
||||
'[/a]'
|
||||
);
|
||||
$sZipDumpExportWarn = __(
|
||||
'%sZip compression%s requires functions (%s) which are unavailable on '
|
||||
. 'this system.'
|
||||
);
|
||||
$sZipDumpExportWarn = sprintf(
|
||||
$sZipDumpExportWarn,
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Import_export]',
|
||||
'[/a]',
|
||||
'%s'
|
||||
);
|
||||
$sZipDumpImportWarn = __(
|
||||
'%sZip decompression%s requires functions (%s) which are unavailable '
|
||||
. 'on this system.'
|
||||
);
|
||||
$sZipDumpImportWarn = sprintf(
|
||||
$sZipDumpImportWarn,
|
||||
'[a@?page=form' . PMA_URL_getCommon(array(), 'html', '&')
|
||||
. '&formset=Features#tab_Import_export]',
|
||||
'[/a]',
|
||||
'%s'
|
||||
);
|
||||
return array(
|
||||
$sAllowArbitraryServerWarn, $sBlowfishSecretMsg, $sBZipDumpWarning,
|
||||
$sDirectoryNotice, $sGZipDumpWarning,
|
||||
$sLoginCookieValidityWarn, $sLoginCookieValidityWarn2,
|
||||
$sLoginCookieValidityWarn3, $sSecurityInfoMsg, $sServerAuthConfigMsg,
|
||||
$sZipDumpExportWarn, $sZipDumpImportWarn
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check configuration for login cookie
|
||||
*
|
||||
* @param string $sLoginCookieValidityWarn Warning 1 for login cookie validity
|
||||
* @param string $sLoginCookieValidityWarn2 Warning 2 for login cookie validity
|
||||
* @param string $sLoginCookieValidityWarn3 Warning 3 for login cookie validity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function performConfigChecksLoginCookie(
|
||||
$sLoginCookieValidityWarn, $sLoginCookieValidityWarn2,
|
||||
$sLoginCookieValidityWarn3
|
||||
) {
|
||||
//
|
||||
// $cfg['LoginCookieValidity']
|
||||
// value greater than session.gc_maxlifetime will cause
|
||||
// random session invalidation after that time
|
||||
$loginCookieValidity = $this->cfg->getValue('LoginCookieValidity');
|
||||
if ($loginCookieValidity > ini_get('session.gc_maxlifetime')
|
||||
) {
|
||||
PMA_messagesSet(
|
||||
'error',
|
||||
'LoginCookieValidity',
|
||||
PMA_lang(PMA_langName('LoginCookieValidity')),
|
||||
PMA_lang($sLoginCookieValidityWarn)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// $cfg['LoginCookieValidity']
|
||||
// should be at most 1800 (30 min)
|
||||
//
|
||||
if ($loginCookieValidity > 1800) {
|
||||
PMA_messagesSet(
|
||||
'notice',
|
||||
'LoginCookieValidity',
|
||||
PMA_lang(PMA_langName('LoginCookieValidity')),
|
||||
PMA_lang($sLoginCookieValidityWarn2)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// $cfg['LoginCookieValidity']
|
||||
// $cfg['LoginCookieStore']
|
||||
// LoginCookieValidity must be less or equal to LoginCookieStore
|
||||
//
|
||||
if (($this->cfg->getValue('LoginCookieStore') != 0)
|
||||
&& ($loginCookieValidity > $this->cfg->getValue('LoginCookieStore'))
|
||||
) {
|
||||
PMA_messagesSet(
|
||||
'error',
|
||||
'LoginCookieValidity',
|
||||
PMA_lang(PMA_langName('LoginCookieValidity')),
|
||||
PMA_lang($sLoginCookieValidityWarn3)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check GZipDump configuration
|
||||
*
|
||||
* @param string $sBZipDumpWarn Warning for BZipDumpWarning
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function performConfigChecksServerBZipdump($sBZipDumpWarn)
|
||||
{
|
||||
//
|
||||
// $cfg['BZipDump']
|
||||
// requires bzip2 functions
|
||||
//
|
||||
if ($this->cfg->getValue('BZipDump')
|
||||
&& (!@function_exists('bzopen') || !@function_exists('bzcompress'))
|
||||
) {
|
||||
$functions = @function_exists('bzopen')
|
||||
? '' :
|
||||
'bzopen';
|
||||
$functions .= @function_exists('bzcompress')
|
||||
? ''
|
||||
: ($functions ? ', ' : '') . 'bzcompress';
|
||||
PMA_messagesSet(
|
||||
'error',
|
||||
'BZipDump',
|
||||
PMA_lang(PMA_langName('BZipDump')),
|
||||
PMA_lang($sBZipDumpWarn, $functions)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check GZipDump configuration
|
||||
*
|
||||
* @param string $sGZipDumpWarn Warning for GZipDumpWarning
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function performConfigChecksServerGZipdump($sGZipDumpWarn)
|
||||
{
|
||||
//
|
||||
// $cfg['GZipDump']
|
||||
// requires zlib functions
|
||||
//
|
||||
if ($this->cfg->getValue('GZipDump')
|
||||
&& (@!function_exists('gzopen') || @!function_exists('gzencode'))
|
||||
) {
|
||||
PMA_messagesSet(
|
||||
'error',
|
||||
'GZipDump',
|
||||
PMA_lang(PMA_langName('GZipDump')),
|
||||
PMA_lang($sGZipDumpWarn, 'gzencode')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
599
#pma/libraries/config/Validator.php
Normal file
599
#pma/libraries/config/Validator.php
Normal file
@ -0,0 +1,599 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Form validation for configuration editor
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
namespace PMA\libraries\config;
|
||||
|
||||
use PMA\libraries\DatabaseInterface;
|
||||
use PMA\libraries\Util;
|
||||
|
||||
/**
|
||||
* Validation class for various validation functions
|
||||
*
|
||||
* Validation function takes two argument: id for which it is called
|
||||
* and array of fields' values (usually values for entire formset, as defined
|
||||
* in forms.inc.php).
|
||||
* The function must always return an array with an error (or error array)
|
||||
* assigned to a form element (formset name or field path). Even if there are
|
||||
* no errors, key must be set with an empty value.
|
||||
*
|
||||
* Validation functions are assigned in $cfg_db['_validators'] (config.values.php).
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
class Validator
|
||||
{
|
||||
/**
|
||||
* Returns validator list
|
||||
*
|
||||
* @param ConfigFile $cf Config file instance
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getValidators(ConfigFile $cf)
|
||||
{
|
||||
static $validators = null;
|
||||
|
||||
if ($validators !== null) {
|
||||
return $validators;
|
||||
}
|
||||
|
||||
$validators = $cf->getDbEntry('_validators', array());
|
||||
if (defined('PMA_SETUP')) {
|
||||
return $validators;
|
||||
}
|
||||
|
||||
// not in setup script: load additional validators for user
|
||||
// preferences we need original config values not overwritten
|
||||
// by user preferences, creating a new PMA\libraries\Config instance is a
|
||||
// better idea than hacking into its code
|
||||
$uvs = $cf->getDbEntry('_userValidators', array());
|
||||
foreach ($uvs as $field => $uv_list) {
|
||||
$uv_list = (array)$uv_list;
|
||||
foreach ($uv_list as &$uv) {
|
||||
if (!is_array($uv)) {
|
||||
continue;
|
||||
}
|
||||
for ($i = 1, $nb = count($uv); $i < $nb; $i++) {
|
||||
if (mb_substr($uv[$i], 0, 6) == 'value:') {
|
||||
$uv[$i] = PMA_arrayRead(
|
||||
mb_substr($uv[$i], 6),
|
||||
$GLOBALS['PMA_Config']->base_settings
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$validators[$field] = isset($validators[$field])
|
||||
? array_merge((array)$validators[$field], $uv_list)
|
||||
: $uv_list;
|
||||
}
|
||||
return $validators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs validation $validator_id on values $values and returns error list.
|
||||
*
|
||||
* Return values:
|
||||
* o array, keys - field path or formset id, values - array of errors
|
||||
* when $isPostSource is true values is an empty array to allow for error list
|
||||
* cleanup in HTML document
|
||||
* o false - when no validators match name(s) given by $validator_id
|
||||
*
|
||||
* @param ConfigFile $cf Config file instance
|
||||
* @param string|array $validator_id ID of validator(s) to run
|
||||
* @param array &$values Values to validate
|
||||
* @param bool $isPostSource tells whether $values are directly from
|
||||
* POST request
|
||||
*
|
||||
* @return bool|array
|
||||
*/
|
||||
public static function validate(
|
||||
ConfigFile $cf, $validator_id, &$values, $isPostSource
|
||||
) {
|
||||
// find validators
|
||||
$validator_id = (array) $validator_id;
|
||||
$validators = static::getValidators($cf);
|
||||
$vids = array();
|
||||
foreach ($validator_id as &$vid) {
|
||||
$vid = $cf->getCanonicalPath($vid);
|
||||
if (isset($validators[$vid])) {
|
||||
$vids[] = $vid;
|
||||
}
|
||||
}
|
||||
if (empty($vids)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// create argument list with canonical paths and remember path mapping
|
||||
$arguments = array();
|
||||
$key_map = array();
|
||||
foreach ($values as $k => $v) {
|
||||
$k2 = $isPostSource ? str_replace('-', '/', $k) : $k;
|
||||
$k2 = mb_strpos($k2, '/')
|
||||
? $cf->getCanonicalPath($k2)
|
||||
: $k2;
|
||||
$key_map[$k2] = $k;
|
||||
$arguments[$k2] = $v;
|
||||
}
|
||||
|
||||
// validate
|
||||
$result = array();
|
||||
foreach ($vids as $vid) {
|
||||
// call appropriate validation functions
|
||||
foreach ((array)$validators[$vid] as $validator) {
|
||||
$vdef = (array) $validator;
|
||||
$vname = array_shift($vdef);
|
||||
$vname = 'PMA\libraries\config\Validator::' . $vname;
|
||||
$args = array_merge(array($vid, &$arguments), $vdef);
|
||||
$r = call_user_func_array($vname, $args);
|
||||
|
||||
// merge results
|
||||
if (!is_array($r)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($r as $key => $error_list) {
|
||||
// skip empty values if $isPostSource is false
|
||||
if (! $isPostSource && empty($error_list)) {
|
||||
continue;
|
||||
}
|
||||
if (! isset($result[$key])) {
|
||||
$result[$key] = array();
|
||||
}
|
||||
$result[$key] = array_merge(
|
||||
$result[$key], (array)$error_list
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// restore original paths
|
||||
$new_result = array();
|
||||
foreach ($result as $k => $v) {
|
||||
$k2 = isset($key_map[$k]) ? $key_map[$k] : $k;
|
||||
$new_result[$k2] = $v;
|
||||
}
|
||||
return empty($new_result) ? true : $new_result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test database connection
|
||||
*
|
||||
* @param string $connect_type 'tcp' or 'socket'
|
||||
* @param string $host host name
|
||||
* @param string $port tcp port to use
|
||||
* @param string $socket socket to use
|
||||
* @param string $user username to use
|
||||
* @param string $pass password to use
|
||||
* @param string $error_key key to use in return array
|
||||
*
|
||||
* @return bool|array
|
||||
*/
|
||||
public static function testDBConnection(
|
||||
$connect_type,
|
||||
$host,
|
||||
$port,
|
||||
$socket,
|
||||
$user,
|
||||
$pass = null,
|
||||
$error_key = 'Server'
|
||||
) {
|
||||
// static::testPHPErrorMsg();
|
||||
$error = null;
|
||||
$host = PMA_sanitizeMySQLHost($host);
|
||||
|
||||
if (DatabaseInterface::checkDbExtension('mysqli')) {
|
||||
$socket = empty($socket) || $connect_type == 'tcp' ? null : $socket;
|
||||
$port = empty($port) || $connect_type == 'socket' ? null : $port;
|
||||
$extension = 'mysqli';
|
||||
} else {
|
||||
$socket = empty($socket) || $connect_type == 'tcp'
|
||||
? null
|
||||
: ':' . ($socket[0] == '/' ? '' : '/') . $socket;
|
||||
$port = empty($port) || $connect_type == 'socket' ? null : ':' . $port;
|
||||
$extension = 'mysql';
|
||||
}
|
||||
|
||||
if ($extension == 'mysql') {
|
||||
$conn = @mysql_connect($host . $port . $socket, $user, $pass);
|
||||
if (! $conn) {
|
||||
$error = __('Could not connect to the database server!');
|
||||
} else {
|
||||
mysql_close($conn);
|
||||
}
|
||||
} else {
|
||||
$conn = @mysqli_connect($host, $user, $pass, null, $port, $socket);
|
||||
if (! $conn) {
|
||||
$error = __('Could not connect to the database server!');
|
||||
} else {
|
||||
mysqli_close($conn);
|
||||
}
|
||||
}
|
||||
// static::testPHPErrorMsg(false);
|
||||
if (isset($php_errormsg)) {
|
||||
$error .= " - $php_errormsg";
|
||||
}
|
||||
return is_null($error) ? true : array($error_key => $error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate server config
|
||||
*
|
||||
* @param string $path path to config, not used
|
||||
* keep this parameter since the method is invoked using
|
||||
* reflection along with other similar methods
|
||||
* @param array $values config values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function validateServer($path, $values)
|
||||
{
|
||||
$result = array(
|
||||
'Server' => '',
|
||||
'Servers/1/user' => '',
|
||||
'Servers/1/SignonSession' => '',
|
||||
'Servers/1/SignonURL' => ''
|
||||
);
|
||||
$error = false;
|
||||
if (empty($values['Servers/1/auth_type'])) {
|
||||
$values['Servers/1/auth_type'] = '';
|
||||
$result['Servers/1/auth_type'] = __('Invalid authentication type!');
|
||||
$error = true;
|
||||
}
|
||||
if ($values['Servers/1/auth_type'] == 'config'
|
||||
&& empty($values['Servers/1/user'])
|
||||
) {
|
||||
$result['Servers/1/user'] = __(
|
||||
'Empty username while using [kbd]config[/kbd] authentication method!'
|
||||
);
|
||||
$error = true;
|
||||
}
|
||||
if ($values['Servers/1/auth_type'] == 'signon'
|
||||
&& empty($values['Servers/1/SignonSession'])
|
||||
) {
|
||||
$result['Servers/1/SignonSession'] = __(
|
||||
'Empty signon session name '
|
||||
. 'while using [kbd]signon[/kbd] authentication method!'
|
||||
);
|
||||
$error = true;
|
||||
}
|
||||
if ($values['Servers/1/auth_type'] == 'signon'
|
||||
&& empty($values['Servers/1/SignonURL'])
|
||||
) {
|
||||
$result['Servers/1/SignonURL'] = __(
|
||||
'Empty signon URL while using [kbd]signon[/kbd] authentication '
|
||||
. 'method!'
|
||||
);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (! $error && $values['Servers/1/auth_type'] == 'config') {
|
||||
$password = '';
|
||||
if (! empty($values['Servers/1/password'])) {
|
||||
$password = $values['Servers/1/password'];
|
||||
}
|
||||
$test = static::testDBConnection(
|
||||
empty($values['Servers/1/connect_type']) ? '' : $values['Servers/1/connect_type'],
|
||||
empty($values['Servers/1/host']) ? '' : $values['Servers/1/host'],
|
||||
empty($values['Servers/1/port']) ? '' : $values['Servers/1/port'],
|
||||
empty($values['Servers/1/socket']) ? '' : $values['Servers/1/socket'],
|
||||
empty($values['Servers/1/user']) ? '' : $values['Servers/1/user'],
|
||||
$password,
|
||||
'Server'
|
||||
);
|
||||
|
||||
// If failed 'with' password, try 'without' password
|
||||
if ($test !== true
|
||||
&& !empty($values['Servers/1/nopassword'])
|
||||
&& $values['Servers/1/nopassword']
|
||||
) {
|
||||
$password = '';
|
||||
$test = static::testDBConnection(
|
||||
empty($values['Servers/1/connect_type']) ? '' : $values['Servers/1/connect_type'],
|
||||
empty($values['Servers/1/host']) ? '' : $values['Servers/1/host'],
|
||||
empty($values['Servers/1/port']) ? '' : $values['Servers/1/port'],
|
||||
empty($values['Servers/1/socket']) ? '' : $values['Servers/1/socket'],
|
||||
empty($values['Servers/1/user']) ? '' : $values['Servers/1/user'],
|
||||
$password,
|
||||
'Server'
|
||||
);
|
||||
}
|
||||
|
||||
if ($test !== true) {
|
||||
$result = array_merge($result, $test);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate pmadb config
|
||||
*
|
||||
* @param string $path path to config, not used
|
||||
* keep this parameter since the method is invoked using
|
||||
* reflection along with other similar methods
|
||||
* @param array $values config values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function validatePMAStorage($path, $values)
|
||||
{
|
||||
$result = array(
|
||||
'Server_pmadb' => '',
|
||||
'Servers/1/controluser' => '',
|
||||
'Servers/1/controlpass' => ''
|
||||
);
|
||||
$error = false;
|
||||
|
||||
if (empty($values['Servers/1/pmadb'])) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
if (empty($values['Servers/1/controluser'])) {
|
||||
$result['Servers/1/controluser'] = __(
|
||||
'Empty phpMyAdmin control user while using phpMyAdmin configuration '
|
||||
. 'storage!'
|
||||
);
|
||||
$error = true;
|
||||
}
|
||||
if (empty($values['Servers/1/controlpass'])) {
|
||||
$result['Servers/1/controlpass'] = __(
|
||||
'Empty phpMyAdmin control user password while using phpMyAdmin '
|
||||
. 'configuration storage!'
|
||||
);
|
||||
$error = true;
|
||||
}
|
||||
if (! $error) {
|
||||
$test = static::testDBConnection(
|
||||
empty($values['Servers/1/connect_type']) ? '' : $values['Servers/1/connect_type'],
|
||||
empty($values['Servers/1/host']) ? '' : $values['Servers/1/host'],
|
||||
empty($values['Servers/1/port']) ? '' : $values['Servers/1/port'],
|
||||
empty($values['Servers/1/socket']) ? '' : $values['Servers/1/socket'],
|
||||
empty($values['Servers/1/controluser']) ? '' : $values['Servers/1/controluser'],
|
||||
empty($values['Servers/1/controlpass']) ? '' : $values['Servers/1/controlpass'],
|
||||
'Server_pmadb'
|
||||
);
|
||||
if ($test !== true) {
|
||||
$result = array_merge($result, $test);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates regular expression
|
||||
*
|
||||
* @param string $path path to config
|
||||
* @param array $values config values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function validateRegex($path, $values)
|
||||
{
|
||||
$result = array($path => '');
|
||||
|
||||
if (empty($values[$path])) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (function_exists('error_clear_last')) {
|
||||
/* PHP 7 only code */
|
||||
error_clear_last();
|
||||
$last_error = null;
|
||||
} else {
|
||||
// As fallback we trigger another error to ensure
|
||||
// that preg error will be different
|
||||
@strpos();
|
||||
$last_error = error_get_last();
|
||||
}
|
||||
|
||||
$matches = array();
|
||||
// in libraries/ListDatabase.php _checkHideDatabase(),
|
||||
// a '/' is used as the delimiter for hide_db
|
||||
@preg_match('/' . Util::requestString($values[$path]) . '/', '', $matches);
|
||||
|
||||
$current_error = error_get_last();
|
||||
|
||||
if ($current_error !== $last_error) {
|
||||
$error = preg_replace('/^preg_match\(\): /', '', $current_error['message']);
|
||||
return array($path => $error);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates TrustedProxies field
|
||||
*
|
||||
* @param string $path path to config
|
||||
* @param array $values config values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function validateTrustedProxies($path, $values)
|
||||
{
|
||||
$result = array($path => array());
|
||||
|
||||
if (empty($values[$path])) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (is_array($values[$path]) || is_object($values[$path])) {
|
||||
// value already processed by FormDisplay::save
|
||||
$lines = array();
|
||||
foreach ($values[$path] as $ip => $v) {
|
||||
$v = Util::requestString($v);
|
||||
$lines[] = preg_match('/^-\d+$/', $ip)
|
||||
? $v
|
||||
: $ip . ': ' . $v;
|
||||
}
|
||||
} else {
|
||||
// AJAX validation
|
||||
$lines = explode("\n", $values[$path]);
|
||||
}
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
$matches = array();
|
||||
// we catch anything that may (or may not) be an IP
|
||||
if (!preg_match("/^(.+):(?:[ ]?)\\w+$/", $line, $matches)) {
|
||||
$result[$path][] = __('Incorrect value:') . ' '
|
||||
. htmlspecialchars($line);
|
||||
continue;
|
||||
}
|
||||
// now let's check whether we really have an IP address
|
||||
if (filter_var($matches[1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false
|
||||
&& filter_var($matches[1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false
|
||||
) {
|
||||
$ip = htmlspecialchars(trim($matches[1]));
|
||||
$result[$path][] = sprintf(__('Incorrect IP address: %s'), $ip);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests integer value
|
||||
*
|
||||
* @param string $path path to config
|
||||
* @param array $values config values
|
||||
* @param bool $allow_neg allow negative values
|
||||
* @param bool $allow_zero allow zero
|
||||
* @param int $max_value max allowed value
|
||||
* @param string $error_string error message key:
|
||||
* $GLOBALS["strConfig$error_lang_key"]
|
||||
*
|
||||
* @return string empty string if test is successful
|
||||
*/
|
||||
public static function validateNumber(
|
||||
$path,
|
||||
$values,
|
||||
$allow_neg,
|
||||
$allow_zero,
|
||||
$max_value,
|
||||
$error_string
|
||||
) {
|
||||
if (empty($values[$path])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$value = Util::requestString($values[$path]);
|
||||
|
||||
if (intval($value) != $value
|
||||
|| (! $allow_neg && $value < 0)
|
||||
|| (! $allow_zero && $value == 0)
|
||||
|| $value > $max_value
|
||||
) {
|
||||
return $error_string;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates port number
|
||||
*
|
||||
* @param string $path path to config
|
||||
* @param array $values config values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function validatePortNumber($path, $values)
|
||||
{
|
||||
return array(
|
||||
$path => static::validateNumber(
|
||||
$path,
|
||||
$values,
|
||||
false,
|
||||
false,
|
||||
65535,
|
||||
__('Not a valid port number!')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates positive number
|
||||
*
|
||||
* @param string $path path to config
|
||||
* @param array $values config values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function validatePositiveNumber($path, $values)
|
||||
{
|
||||
return array(
|
||||
$path => static::validateNumber(
|
||||
$path,
|
||||
$values,
|
||||
false,
|
||||
false,
|
||||
PHP_INT_MAX,
|
||||
__('Not a positive number!')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates non-negative number
|
||||
*
|
||||
* @param string $path path to config
|
||||
* @param array $values config values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function validateNonNegativeNumber($path, $values)
|
||||
{
|
||||
return array(
|
||||
$path => static::validateNumber(
|
||||
$path,
|
||||
$values,
|
||||
false,
|
||||
true,
|
||||
PHP_INT_MAX,
|
||||
__('Not a non-negative number!')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates value according to given regular expression
|
||||
* Pattern and modifiers must be a valid for PCRE <b>and</b> JavaScript RegExp
|
||||
*
|
||||
* @param string $path path to config
|
||||
* @param array $values config values
|
||||
* @param string $regex regular expression to match
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function validateByRegex($path, $values, $regex)
|
||||
{
|
||||
if (!isset($values[$path])) {
|
||||
return '';
|
||||
}
|
||||
$result = preg_match($regex, Util::requestString($values[$path]));
|
||||
return array($path => ($result ? '' : __('Incorrect value!')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates upper bound for numeric inputs
|
||||
*
|
||||
* @param string $path path to config
|
||||
* @param array $values config values
|
||||
* @param int $max_value maximal allowed value
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function validateUpperBound($path, $values, $max_value)
|
||||
{
|
||||
$result = $values[$path] <= $max_value;
|
||||
return array($path => ($result ? ''
|
||||
: sprintf(__('Value must be equal or lower than %s!'), $max_value)));
|
||||
}
|
||||
}
|
53
#pma/libraries/config/config_functions.lib.php
Normal file
53
#pma/libraries/config/config_functions.lib.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Common config manipulation functions
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_lang($lang_key)
|
||||
{
|
||||
$message = isset($GLOBALS["strConfig$lang_key"])
|
||||
? $GLOBALS["strConfig$lang_key"] : $lang_key;
|
||||
|
||||
$message = PMA_sanitize($message);
|
||||
|
||||
if (func_num_args() == 1) {
|
||||
return $message;
|
||||
} else {
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
return vsprintf($message, $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns translated field name/description or comment
|
||||
*
|
||||
* @param string $canonical_path path to handle
|
||||
* @param string $type 'name', 'desc' or 'cmt'
|
||||
* @param mixed $default default value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_langName($canonical_path, $type = 'name', $default = 'key')
|
||||
{
|
||||
$lang_key = str_replace(
|
||||
array('Servers/1/', '/'),
|
||||
array('Servers/', '_'),
|
||||
$canonical_path
|
||||
) . '_' . $type;
|
||||
return isset($GLOBALS["strConfig$lang_key"])
|
||||
? ($type == 'desc' ? PMA_lang($lang_key) : $GLOBALS["strConfig$lang_key"])
|
||||
: ($default == 'key' ? $lang_key : $default);
|
||||
}
|
995
#pma/libraries/config/messages.inc.php
Normal file
995
#pma/libraries/config/messages.inc.php
Normal file
@ -0,0 +1,995 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Messages for phpMyAdmin.
|
||||
*
|
||||
* This file defines variables in a special format suited for the
|
||||
* configuration subsystem, with $strConfig as a prefix, _desc or _name
|
||||
* as a suffix, and the directive name in between.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
if (!function_exists('__')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$strConfigAllowArbitraryServer_desc = __(
|
||||
'If enabled, user can enter any MySQL server in login form for cookie auth.'
|
||||
);
|
||||
$strConfigAllowArbitraryServer_name = __('Allow login to any MySQL server');
|
||||
$strConfigArbitraryServerRegexp_desc = __(
|
||||
'Restricts the MySQL servers the user can enter when a login to an arbitrary '
|
||||
. 'MySQL server is enabled by matching the IP or hostname of the MySQL server ' .
|
||||
'to the given regular expression.'
|
||||
);
|
||||
$strConfigArbitraryServerRegexp_name = __('Restrict login to MySQL server');
|
||||
$strConfigAllowThirdPartyFraming_desc = __(
|
||||
'Enabling this allows a page located on a different domain to call phpMyAdmin '
|
||||
. 'inside a frame, and is a potential [strong]security hole[/strong] allowing '
|
||||
. 'cross-frame scripting (XSS) attacks.'
|
||||
);
|
||||
$strConfigAllowThirdPartyFraming_name = __('Allow third party framing');
|
||||
$strConfigAllowUserDropDatabase_name
|
||||
= __('Show "Drop database" link to normal users');
|
||||
$strConfigblowfish_secret_desc = __(
|
||||
'Secret passphrase used for encrypting cookies in [kbd]cookie[/kbd] '
|
||||
. 'authentication.'
|
||||
);
|
||||
$strConfigblowfish_secret_name = __('Blowfish secret');
|
||||
$strConfigBrowseMarkerEnable_desc = __('Highlight selected rows.');
|
||||
$strConfigBrowseMarkerEnable_name = __('Row marker');
|
||||
$strConfigBrowsePointerEnable_desc = __(
|
||||
'Highlight row pointed by the mouse cursor.'
|
||||
);
|
||||
$strConfigBrowsePointerEnable_name = __('Highlight pointer');
|
||||
$strConfigBZipDump_desc = __(
|
||||
'Enable bzip2 compression for'
|
||||
. ' import operations.'
|
||||
);
|
||||
$strConfigBZipDump_name = __('Bzip2');
|
||||
$strConfigCharEditing_desc = __(
|
||||
'Defines which type of editing controls should be used for CHAR and VARCHAR '
|
||||
. 'columns; [kbd]input[/kbd] - allows limiting of input length, '
|
||||
. '[kbd]textarea[/kbd] - allows newlines in columns.'
|
||||
);
|
||||
$strConfigCharEditing_name = __('CHAR columns editing');
|
||||
$strConfigCodemirrorEnable_desc = __(
|
||||
'Use user-friendly editor for editing SQL queries '
|
||||
. '(CodeMirror) with syntax highlighting and '
|
||||
. 'line numbers.'
|
||||
);
|
||||
$strConfigCodemirrorEnable_name = __('Enable CodeMirror');
|
||||
$strConfigLintEnable_desc = __(
|
||||
'Find any errors in the query before executing it.'
|
||||
. ' Requires CodeMirror to be enabled.'
|
||||
);
|
||||
$strConfigLintEnable_name = __('Enable linter');
|
||||
$strConfigMinSizeForInputField_desc = __(
|
||||
'Defines the minimum size for input fields generated for CHAR and VARCHAR '
|
||||
. 'columns.'
|
||||
);
|
||||
$strConfigMinSizeForInputField_name = __('Minimum size for input field');
|
||||
$strConfigMaxSizeForInputField_desc = __(
|
||||
'Defines the maximum size for input fields generated for CHAR and VARCHAR '
|
||||
. 'columns.'
|
||||
);
|
||||
$strConfigMaxSizeForInputField_name = __('Maximum size for input field');
|
||||
$strConfigCharTextareaCols_desc = __(
|
||||
'Number of columns for CHAR/VARCHAR textareas.'
|
||||
);
|
||||
$strConfigCharTextareaCols_name = __('CHAR textarea columns');
|
||||
$strConfigCharTextareaRows_desc = __('Number of rows for CHAR/VARCHAR textareas.');
|
||||
$strConfigCharTextareaRows_name = __('CHAR textarea rows');
|
||||
$strConfigCheckConfigurationPermissions_name = __('Check config file permissions');
|
||||
$strConfigCompressOnFly_desc = __(
|
||||
'Compress gzip exports on the fly without the need for much memory; if '
|
||||
. 'you encounter problems with created gzip files disable this feature.'
|
||||
);
|
||||
$strConfigCompressOnFly_name = __('Compress on the fly');
|
||||
$strConfigConfigurationFile = __('Configuration file');
|
||||
$strConfigConfirm_desc = __(
|
||||
'Whether a warning ("Are your really sure…") should be displayed '
|
||||
. 'when you\'re about to lose data.'
|
||||
);
|
||||
$strConfigConfirm_name = __('Confirm DROP queries');
|
||||
$strConfigDBG_sql_desc = __(
|
||||
'Log SQL queries and their execution time, to be displayed in the console'
|
||||
);
|
||||
$strConfigDBG_sql_name = __('Debug SQL');
|
||||
$strConfigDefaultTabDatabase_desc
|
||||
= __('Tab that is displayed when entering a database.');
|
||||
$strConfigDefaultTabDatabase_name = __('Default database tab');
|
||||
$strConfigDefaultTabServer_desc = __(
|
||||
'Tab that is displayed when entering a server.'
|
||||
);
|
||||
$strConfigDefaultTabServer_name = __('Default server tab');
|
||||
$strConfigDefaultTabTable_desc = __('Tab that is displayed when entering a table.');
|
||||
$strConfigDefaultTabTable_name = __('Default table tab');
|
||||
$strConfigEnableAutocompleteForTablesAndColumns_desc = __(
|
||||
'Autocomplete of the table and column names in the SQL queries.'
|
||||
);
|
||||
$strConfigEnableAutocompleteForTablesAndColumns_name = __(
|
||||
'Enable autocomplete for table and column names'
|
||||
);
|
||||
$strConfigHideStructureActions_desc
|
||||
= __('Whether the table structure actions should be hidden.');
|
||||
$strConfigShowColumnComments_name = __('Show column comments');
|
||||
$strConfigShowColumnComments_desc
|
||||
= __('Whether column comments should be shown in table structure view');
|
||||
$strConfigHideStructureActions_name = __('Hide table structure actions');
|
||||
$strConfigDisplayServersList_desc
|
||||
= __('Show server listing as a list instead of a drop down.');
|
||||
$strConfigDisplayServersList_name = __('Display servers as a list');
|
||||
$strConfigDisableMultiTableMaintenance_desc = __(
|
||||
'Disable the table maintenance mass operations, like optimizing or repairing '
|
||||
. 'the selected tables of a database.'
|
||||
);
|
||||
$strConfigDisableMultiTableMaintenance_name = __('Disable multi table maintenance');
|
||||
$strConfigExecTimeLimit_desc = __(
|
||||
'Set the number of seconds a script is allowed to run ([kbd]0[/kbd] for no '
|
||||
. 'limit).'
|
||||
);
|
||||
$strConfigExecTimeLimit_name = __('Maximum execution time');
|
||||
$strConfigExport_lock_tables_name = sprintf(
|
||||
__('Use %s statement'), '<code>LOCK TABLES</code>'
|
||||
);
|
||||
$strConfigExport_asfile_name = __('Save as file');
|
||||
$strConfigExport_charset_name = __('Character set of the file');
|
||||
$strConfigExport_codegen_format_name = __('Format');
|
||||
$strConfigExport_compression_name = __('Compression');
|
||||
$strConfigExport_csv_columns_name = __('Put columns names in the first row');
|
||||
$strConfigExport_csv_enclosed_name = __('Columns enclosed with');
|
||||
$strConfigExport_csv_escaped_name = __('Columns escaped with');
|
||||
$strConfigExport_csv_null_name = __('Replace NULL with');
|
||||
$strConfigExport_csv_removeCRLF_name = __('Remove CRLF characters within columns');
|
||||
$strConfigExport_csv_separator_name = __('Columns terminated with');
|
||||
$strConfigExport_csv_terminated_name = __('Lines terminated with');
|
||||
$strConfigExport_excel_columns_name = __('Put columns names in the first row');
|
||||
$strConfigExport_excel_edition_name = __('Excel edition');
|
||||
$strConfigExport_excel_null_name = __('Replace NULL with');
|
||||
$strConfigExport_excel_removeCRLF_name = __('Remove CRLF characters within columns');
|
||||
$strConfigExport_file_template_database_name = __('Database name template');
|
||||
$strConfigExport_file_template_server_name = __('Server name template');
|
||||
$strConfigExport_file_template_table_name = __('Table name template');
|
||||
$strConfigExport_format_name = __('Format');
|
||||
$strConfigExport_htmlword_columns_name = __('Put columns names in the first row');
|
||||
$strConfigExport_htmlword_null_name = __('Replace NULL with');
|
||||
$strConfigExport_htmlword_structure_or_data_name = __('Dump table');
|
||||
$strConfigExport_latex_caption_name = __('Include table caption');
|
||||
$strConfigExport_latex_columns_name = __('Put columns names in the first row');
|
||||
$strConfigExport_latex_comments_name = __('Comments');
|
||||
$strConfigExport_latex_data_caption_name = __('Table caption');
|
||||
$strConfigExport_latex_data_continued_caption_name = __('Continued table caption');
|
||||
$strConfigExport_latex_data_label_name = __('Label key');
|
||||
$strConfigExport_latex_mime_name = __('MIME type');
|
||||
$strConfigExport_latex_null_name = __('Replace NULL with');
|
||||
$strConfigExport_latex_relation_name = __('Relations');
|
||||
$strConfigExport_latex_structure_caption_name = __('Table caption');
|
||||
$strConfigExport_latex_structure_continued_caption_name
|
||||
= __('Continued table caption');
|
||||
$strConfigExport_latex_structure_label_name = __('Label key');
|
||||
$strConfigExport_latex_structure_or_data_name = __('Dump table');
|
||||
$strConfigExport_method_name = __('Export method');
|
||||
$strConfigExport_ods_columns_name = __('Put columns names in the first row');
|
||||
$strConfigExport_ods_null_name = __('Replace NULL with');
|
||||
$strConfigExport_odt_columns_name = __('Put columns names in the first row');
|
||||
$strConfigExport_odt_comments_name = __('Comments');
|
||||
$strConfigExport_odt_mime_name = __('MIME type');
|
||||
$strConfigExport_odt_null_name = __('Replace NULL with');
|
||||
$strConfigExport_odt_relation_name = __('Relations');
|
||||
$strConfigExport_odt_structure_or_data_name = __('Dump table');
|
||||
$strConfigExport_onserver_name = __('Save on server');
|
||||
$strConfigExport_onserver_overwrite_name = __('Overwrite existing file(s)');
|
||||
$strConfigExport_as_separate_files_name = __('Export as separate files');
|
||||
$strConfigExport_quick_export_onserver_name = __('Save on server');
|
||||
$strConfigExport_quick_export_onserver_overwrite_name
|
||||
= __('Overwrite existing file(s)');
|
||||
$strConfigExport_remember_file_template_name = __('Remember file name template');
|
||||
$strConfigExport_sql_auto_increment_name = __('Add AUTO_INCREMENT value');
|
||||
$strConfigExport_sql_backquotes_name
|
||||
= __('Enclose table and column names with backquotes');
|
||||
$strConfigExport_sql_compatibility_name = __('SQL compatibility mode');
|
||||
$strConfigExport_sql_dates_name = __('Creation/Update/Check dates');
|
||||
$strConfigExport_sql_delayed_name = __('Use delayed inserts');
|
||||
$strConfigExport_sql_disable_fk_name = __('Disable foreign key checks');
|
||||
$strConfigExport_sql_views_as_tables_name = __('Export views as tables');
|
||||
$strConfigExport_sql_metadata_name = __(
|
||||
'Export related metadata from phpMyAdmin configuration storage'
|
||||
);
|
||||
$strConfigExport_sql_create_database_name = sprintf(__('Add %s'), 'CREATE DATABASE / USE');
|
||||
$strConfigExport_sql_drop_database_name = sprintf(__('Add %s'), 'DROP DATABASE');
|
||||
$strConfigExport_sql_drop_table_name = sprintf(
|
||||
__('Add %s'), 'DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT / TRIGGER'
|
||||
);
|
||||
$strConfigExport_sql_create_table_name = sprintf(__('Add %s'), 'CREATE TABLE');
|
||||
$strConfigExport_sql_create_view_name = sprintf(__('Add %s'), 'CREATE VIEW');
|
||||
$strConfigExport_sql_create_trigger_name
|
||||
= sprintf(__('Add %s'), 'CREATE TRIGGER');
|
||||
$strConfigExport_sql_hex_for_binary_name = __('Use hexadecimal for BINARY & BLOB');
|
||||
$strConfigExport_sql_if_not_exists_name = __(
|
||||
'Add IF NOT EXISTS (less efficient as indexes will be generated during'
|
||||
. ' table creation)'
|
||||
);
|
||||
$strConfigExport_sql_ignore_name = __('Use ignore inserts');
|
||||
$strConfigExport_sql_include_comments_name = __('Comments');
|
||||
$strConfigExport_sql_insert_syntax_name = __('Syntax to use when inserting data');
|
||||
$strConfigExport_sql_max_query_size_name = __('Maximal length of created query');
|
||||
$strConfigExport_sql_mime_name = __('MIME type');
|
||||
$strConfigExport_sql_procedure_function_name
|
||||
= sprintf(__('Add %s'), 'CREATE PROCEDURE / FUNCTION / EVENT');
|
||||
$strConfigExport_sql_relation_name = __('Relations');
|
||||
$strConfigExport_sql_structure_or_data_name = __('Dump table');
|
||||
$strConfigExport_sql_type_name = __('Export type');
|
||||
$strConfigExport_sql_use_transaction_name = __('Enclose export in a transaction');
|
||||
$strConfigExport_sql_utc_time_name = __('Export time in UTC');
|
||||
$strConfigExport_texytext_columns_name = __('Put columns names in the first row');
|
||||
$strConfigExport_texytext_null_name = __('Replace NULL with');
|
||||
$strConfigExport_texytext_structure_or_data_name = __('Dump table');
|
||||
$strConfigExport_xls_columns_name = __('Put columns names in the first row');
|
||||
$strConfigExport_xls_null_name = __('Replace NULL with');
|
||||
$strConfigExport_xlsx_columns_name = __('Put columns names in the first row');
|
||||
$strConfigExport_xlsx_null_name = __('Replace NULL with');
|
||||
$strConfigForeignKeyDropdownOrder_desc = __(
|
||||
'Sort order for items in a foreign-key dropdown box; [kbd]content[/kbd] is '
|
||||
. 'the referenced data, [kbd]id[/kbd] is the key value.'
|
||||
);
|
||||
$strConfigForeignKeyDropdownOrder_name = __('Foreign key dropdown order');
|
||||
$strConfigForeignKeyMaxLimit_desc
|
||||
= __('A dropdown will be used if fewer items are present.');
|
||||
$strConfigForeignKeyMaxLimit_name = __('Foreign key limit');
|
||||
$strConfigDefaultForeignKeyChecks_desc = __(
|
||||
'Default value for foreign key checks checkbox for some queries.'
|
||||
);
|
||||
$strConfigDefaultForeignKeyChecks_name = __('Foreign key checks');
|
||||
$strConfigForm_Browse = __('Browse mode');
|
||||
$strConfigForm_Browse_desc = __('Customize browse mode.');
|
||||
$strConfigForm_CodeGen = 'CodeGen';
|
||||
$strConfigForm_CodeGen_desc = __('Customize default options.');
|
||||
$strConfigForm_Csv = __('CSV');
|
||||
$strConfigForm_Csv_desc = __('Customize default options.');
|
||||
$strConfigForm_Developer = __('Developer');
|
||||
$strConfigForm_Developer_desc = __('Settings for phpMyAdmin developers.');
|
||||
$strConfigForm_Edit = __('Edit mode');
|
||||
$strConfigForm_Edit_desc = __('Customize edit mode.');
|
||||
$strConfigForm_Export = __('Export');
|
||||
$strConfigForm_Export_defaults = __('Export defaults');
|
||||
$strConfigForm_Export_defaults_desc = __('Customize default export options.');
|
||||
$strConfigForm_Features = __('Features');
|
||||
$strConfigForm_General = __('General');
|
||||
$strConfigForm_General_desc = __('Set some commonly used options.');
|
||||
$strConfigForm_Import = __('Import');
|
||||
$strConfigForm_Import_defaults = __('Import defaults');
|
||||
$strConfigForm_Import_defaults_desc = __('Customize default common import options.');
|
||||
$strConfigForm_Import_export = __('Import / export');
|
||||
$strConfigForm_Import_export_desc
|
||||
= __('Set import and export directories and compression options.');
|
||||
$strConfigForm_Latex = __('LaTeX');
|
||||
$strConfigForm_Latex_desc = __('Customize default options.');
|
||||
$strConfigForm_Navi_databases = __('Databases');
|
||||
$strConfigForm_Navi_databases_desc = __('Databases display options.');
|
||||
$strConfigForm_Navi_panel = __('Navigation panel');
|
||||
$strConfigForm_Navi_panel_desc = __('Customize appearance of the navigation panel.');
|
||||
$strConfigForm_Navi_tree = __('Navigation tree');
|
||||
$strConfigForm_Navi_tree_desc = __('Customize the navigation tree.');
|
||||
$strConfigForm_Navi_servers = __('Servers');
|
||||
$strConfigForm_Navi_servers_desc = __('Servers display options.');
|
||||
$strConfigForm_Navi_tables = __('Tables');
|
||||
$strConfigForm_Navi_tables_desc = __('Tables display options.');
|
||||
$strConfigForm_Main_panel = __('Main panel');
|
||||
$strConfigForm_Microsoft_Office = __('Microsoft Office');
|
||||
$strConfigForm_Microsoft_Office_desc = __('Customize default options.');
|
||||
$strConfigForm_Open_Document = 'OpenDocument';
|
||||
$strConfigForm_Open_Document_desc = __('Customize default options.');
|
||||
$strConfigForm_Other_core_settings = __('Other core settings');
|
||||
$strConfigForm_Other_core_settings_desc
|
||||
= __('Settings that didn\'t fit anywhere else.');
|
||||
$strConfigForm_Page_titles = __('Page titles');
|
||||
$strConfigForm_Page_titles_desc = __(
|
||||
'Specify browser\'s title bar text. Refer to '
|
||||
. '[doc@faq6-27]documentation[/doc] for magic strings that can be used '
|
||||
. 'to get special values.'
|
||||
);
|
||||
$strConfigForm_Security = __('Security');
|
||||
$strConfigForm_Security_desc = __(
|
||||
'Please note that phpMyAdmin is just a user interface and its features do not '
|
||||
. 'limit MySQL.'
|
||||
);
|
||||
$strConfigForm_Server = __('Basic settings');
|
||||
$strConfigForm_Server_auth = __('Authentication');
|
||||
$strConfigForm_Server_auth_desc = __('Authentication settings.');
|
||||
$strConfigForm_Server_config = __('Server configuration');
|
||||
$strConfigForm_Server_config_desc = __(
|
||||
'Advanced server configuration, do not change these options unless you know '
|
||||
. 'what they are for.'
|
||||
);
|
||||
$strConfigForm_Server_desc = __('Enter server connection parameters.');
|
||||
$strConfigForm_Server_pmadb = __('Configuration storage');
|
||||
$strConfigForm_Server_pmadb_desc = __(
|
||||
'Configure phpMyAdmin configuration storage to gain access to additional '
|
||||
. 'features, see [doc@linked-tables]phpMyAdmin configuration storage[/doc] in '
|
||||
. 'documentation.'
|
||||
);
|
||||
$strConfigForm_Server_tracking = __('Changes tracking');
|
||||
$strConfigForm_Server_tracking_desc = __(
|
||||
'Tracking of changes made in database. Requires the phpMyAdmin configuration '
|
||||
. 'storage.'
|
||||
);
|
||||
$strConfigFormset_Export = __('Customize export options');
|
||||
$strConfigFormset_Features = __('Features');
|
||||
$strConfigFormset_Import = __('Customize import defaults');
|
||||
$strConfigFormset_Navi_panel = __('Customize navigation panel');
|
||||
$strConfigFormset_Main_panel = __('Customize main panel');
|
||||
$strConfigFormset_Sql_queries = __('SQL queries');
|
||||
$strConfigForm_Sql = __('SQL');
|
||||
$strConfigForm_Sql_box = __('SQL Query box');
|
||||
$strConfigForm_Sql_box_desc = __('Customize links shown in SQL Query boxes.');
|
||||
$strConfigForm_Sql_desc = __('Customize default options.');
|
||||
$strConfigForm_Sql_queries = __('SQL queries');
|
||||
$strConfigForm_Sql_queries_desc = __('SQL queries settings.');
|
||||
$strConfigForm_Startup = __('Startup');
|
||||
$strConfigForm_Startup_desc = __('Customize startup page.');
|
||||
$strConfigForm_DbStructure = __('Database structure');
|
||||
$strConfigForm_DbStructure_desc
|
||||
= __('Choose which details to show in the database structure (list of tables).');
|
||||
$strConfigForm_TableStructure = __('Table structure');
|
||||
$strConfigForm_TableStructure_desc
|
||||
= __('Settings for the table structure (list of columns).');
|
||||
$strConfigForm_Tabs = __('Tabs');
|
||||
$strConfigForm_Tabs_desc = __('Choose how you want tabs to work.');
|
||||
$strConfigForm_DisplayRelationalSchema = __('Display relational schema');
|
||||
$strConfigForm_DisplayRelationalSchema_desc = '';
|
||||
$strConfigPDFDefaultPageSize_name = __('Paper size');
|
||||
$strConfigPDFDefaultPageSize_desc = '';
|
||||
$strConfigForm_Databases = __('Databases');
|
||||
$strConfigForm_Text_fields = __('Text fields');
|
||||
$strConfigForm_Text_fields_desc = __('Customize text input fields.');
|
||||
$strConfigForm_Texy = __('Texy! text');
|
||||
$strConfigForm_Texy_desc = __('Customize default options');
|
||||
$strConfigForm_Warnings = __('Warnings');
|
||||
$strConfigForm_Warnings_desc
|
||||
= __('Disable some of the warnings shown by phpMyAdmin.');
|
||||
$strConfigGZipDump_desc = __(
|
||||
'Enable gzip compression for import '
|
||||
. 'and export operations.'
|
||||
);
|
||||
$strConfigGZipDump_name = __('GZip');
|
||||
$strConfigIconvExtraParams_name = __('Extra parameters for iconv');
|
||||
$strConfigIgnoreMultiSubmitErrors_desc = __(
|
||||
'If enabled, phpMyAdmin continues computing multiple-statement queries even if '
|
||||
. 'one of the queries failed.'
|
||||
);
|
||||
$strConfigIgnoreMultiSubmitErrors_name = __('Ignore multiple statement errors');
|
||||
$strConfigImport_allow_interrupt_desc = __(
|
||||
'Allow interrupt of import in case script detects it is close to time limit. '
|
||||
. 'This might be a good way to import large files, however it can break '
|
||||
. 'transactions.'
|
||||
);
|
||||
$strConfigImport_allow_interrupt_name = __('Partial import: allow interrupt');
|
||||
$strConfigImport_charset_name = __('Character set of the file');
|
||||
$strConfigImport_csv_col_names_name = __('Lines terminated with');
|
||||
$strConfigImport_csv_enclosed_name = __('Columns enclosed with');
|
||||
$strConfigImport_csv_escaped_name = __('Columns escaped with');
|
||||
$strConfigImport_csv_ignore_name = __('Do not abort on INSERT error');
|
||||
$strConfigImport_csv_replace_name = __('Add ON DUPLICATE KEY UPDATE');
|
||||
$strConfigImport_csv_replace_desc = __(
|
||||
'Update data when duplicate keys found on import'
|
||||
);
|
||||
$strConfigImport_csv_terminated_name = __('Columns terminated with');
|
||||
$strConfigImport_format_desc = __(
|
||||
'Default format; be aware that this list depends on location (database, table) '
|
||||
. 'and only SQL is always available.'
|
||||
);
|
||||
$strConfigImport_format_name = __('Format of imported file');
|
||||
$strConfigImport_ldi_enclosed_name = __('Columns enclosed with');
|
||||
$strConfigImport_ldi_escaped_name = __('Columns escaped with');
|
||||
$strConfigImport_ldi_ignore_name = __('Do not abort on INSERT error');
|
||||
$strConfigImport_ldi_local_option_name = __('Use LOCAL keyword');
|
||||
$strConfigImport_ldi_replace_name = __('Add ON DUPLICATE KEY UPDATE');
|
||||
$strConfigImport_ldi_replace_desc = __(
|
||||
'Update data when duplicate keys found on import'
|
||||
);
|
||||
$strConfigImport_ldi_terminated_name = __('Columns terminated with');
|
||||
$strConfigImport_ods_col_names_name = __('Column names in first row');
|
||||
$strConfigImport_ods_empty_rows_name = __('Do not import empty rows');
|
||||
$strConfigImport_ods_recognize_currency_name
|
||||
= __('Import currencies ($5.00 to 5.00)');
|
||||
$strConfigImport_ods_recognize_percentages_name
|
||||
= __('Import percentages as proper decimals (12.00% to .12)');
|
||||
$strConfigImport_skip_queries_desc = __('Number of queries to skip from start.');
|
||||
$strConfigImport_skip_queries_name = __('Partial import: skip queries');
|
||||
$strConfigImport_sql_compatibility_name = __('SQL compatibility mode');
|
||||
$strConfigImport_sql_no_auto_value_on_zero_name
|
||||
= __('Do not use AUTO_INCREMENT for zero values');
|
||||
$strConfigImport_sql_read_as_multibytes_name = __('Read as multibytes');
|
||||
$strConfigImport_xls_col_names_name = __('Column names in first row');
|
||||
$strConfigImport_xlsx_col_names_name = __('Column names in first row');
|
||||
$strConfigInitialSlidersState_name = __('Initial state for sliders');
|
||||
$strConfigInsertRows_desc = __('How many rows can be inserted at one time.');
|
||||
$strConfigInsertRows_name = __('Number of inserted rows');
|
||||
$strConfigLimitChars_desc = __(
|
||||
'Maximum number of characters shown in any non-numeric column on browse view.'
|
||||
);
|
||||
$strConfigLimitChars_name = __('Limit column characters');
|
||||
$strConfigLoginCookieDeleteAll_desc = __(
|
||||
'If TRUE, logout deletes cookies for all servers; when set to FALSE, logout '
|
||||
. 'only occurs for the current server. Setting this to FALSE makes it easy to '
|
||||
. 'forget to log out from other servers when connected to multiple servers.'
|
||||
);
|
||||
$strConfigLoginCookieDeleteAll_name = __('Delete all cookies on logout');
|
||||
$strConfigLoginCookieRecall_desc = __(
|
||||
'Define whether the previous login should be recalled or not in '
|
||||
. '[kbd]cookie[/kbd] authentication mode.'
|
||||
);
|
||||
$strConfigLoginCookieRecall_name = __('Recall user name');
|
||||
$strConfigLoginCookieStore_desc = __(
|
||||
'Defines how long (in seconds) a login cookie should be stored in browser. '
|
||||
. 'The default of 0 means that it will be kept for the existing session only, '
|
||||
. 'and will be deleted as soon as you close the browser window. This is '
|
||||
. 'recommended for non-trusted environments.'
|
||||
);
|
||||
$strConfigLoginCookieStore_name = __('Login cookie store');
|
||||
$strConfigLoginCookieValidity_desc
|
||||
= __('Define how long (in seconds) a login cookie is valid.');
|
||||
$strConfigLoginCookieValidity_name = __('Login cookie validity');
|
||||
$strConfigLongtextDoubleTextarea_desc
|
||||
= __('Double size of textarea for LONGTEXT columns.');
|
||||
$strConfigLongtextDoubleTextarea_name = __('Bigger textarea for LONGTEXT');
|
||||
$strConfigMaxCharactersInDisplayedSQL_desc
|
||||
= __('Maximum number of characters used when a SQL query is displayed.');
|
||||
$strConfigMaxCharactersInDisplayedSQL_name = __('Maximum displayed SQL length');
|
||||
$strConfigMaxDbList_cmt = __('Users cannot set a higher value');
|
||||
$strConfigMaxDbList_desc
|
||||
= __('Maximum number of databases displayed in database list.');
|
||||
$strConfigMaxDbList_name = __('Maximum databases');
|
||||
$strConfigFirstLevelNavigationItems_desc = __(
|
||||
'The number of items that can be displayed on each page on the first level'
|
||||
. ' of the navigation tree.'
|
||||
);
|
||||
$strConfigFirstLevelNavigationItems_name = __('Maximum items on first level');
|
||||
$strConfigMaxNavigationItems_desc = __(
|
||||
'The number of items that can be displayed on each page of the navigation tree.'
|
||||
);
|
||||
$strConfigMaxNavigationItems_name = __('Maximum items in branch');
|
||||
$strConfigMaxRows_desc = __(
|
||||
'Number of rows displayed when browsing a result set. If the result set '
|
||||
. 'contains more rows, "Previous" and "Next" links will be '
|
||||
. 'shown.'
|
||||
);
|
||||
$strConfigMaxRows_name = __('Maximum number of rows to display');
|
||||
$strConfigMaxTableList_cmt = __('Users cannot set a higher value');
|
||||
$strConfigMaxTableList_desc = __(
|
||||
'Maximum number of tables displayed in table list.'
|
||||
);
|
||||
$strConfigMaxTableList_name = __('Maximum tables');
|
||||
$strConfigMemoryLimit_desc = __(
|
||||
'The number of bytes a script is allowed to allocate, eg. [kbd]32M[/kbd] '
|
||||
. '([kbd]-1[/kbd] for no limit and [kbd]0[/kbd] for no change).'
|
||||
);
|
||||
$strConfigMemoryLimit_name = __('Memory limit');
|
||||
$strConfigShowDatabasesNavigationAsTree_desc = __(
|
||||
'In the navigation panel, replaces the database tree with a selector'
|
||||
);
|
||||
$strConfigShowDatabasesNavigationAsTree_name = __(
|
||||
'Show databases navigation as tree'
|
||||
);
|
||||
$strConfigNavigationLinkWithMainPanel_desc = __(
|
||||
'Link with main panel by highlighting the current database or table.'
|
||||
);
|
||||
$strConfigNavigationLinkWithMainPanel_name = __('Link with main panel');
|
||||
$strConfigNavigationDisplayLogo_desc = __('Show logo in navigation panel.');
|
||||
$strConfigNavigationDisplayLogo_name = __('Display logo');
|
||||
$strConfigNavigationLogoLink_desc
|
||||
= __('URL where logo in the navigation panel will point to.');
|
||||
$strConfigNavigationLogoLink_name = __('Logo link URL');
|
||||
$strConfigNavigationLogoLinkWindow_desc = __(
|
||||
'Open the linked page in the main window ([kbd]main[/kbd]) or in a new one '
|
||||
. '([kbd]new[/kbd]).'
|
||||
);
|
||||
$strConfigNavigationLogoLinkWindow_name = __('Logo link target');
|
||||
$strConfigNavigationDisplayServers_desc
|
||||
= __('Display server choice at the top of the navigation panel.');
|
||||
$strConfigNavigationDisplayServers_name = __('Display servers selection');
|
||||
$strConfigNavigationTreeDefaultTabTable_name = __('Target for quick access icon');
|
||||
$strConfigNavigationTreeDefaultTabTable2_name = __(
|
||||
'Target for second quick access icon'
|
||||
);
|
||||
$strConfigNavigationTreeDisplayItemFilterMinimum_desc = __(
|
||||
'Defines the minimum number of items (tables, views, routines and events) to '
|
||||
. 'display a filter box.'
|
||||
);
|
||||
$strConfigNavigationTreeDisplayItemFilterMinimum_name
|
||||
= __('Minimum number of items to display the filter box');
|
||||
$strConfigNavigationTreeDisplayDbFilterMinimum_name
|
||||
= __('Minimum number of databases to display the database filter box');
|
||||
$strConfigNavigationTreeEnableGrouping_desc = __(
|
||||
'Group items in the navigation tree (determined by the separator defined in ' .
|
||||
'the Databases and Tables tabs above).'
|
||||
);
|
||||
$strConfigNavigationTreeEnableGrouping_name = __('Group items in the tree');
|
||||
$strConfigNavigationTreeDbSeparator_desc
|
||||
= __('String that separates databases into different tree levels.');
|
||||
$strConfigNavigationTreeDbSeparator_name = __('Database tree separator');
|
||||
$strConfigNavigationTreeTableSeparator_desc
|
||||
= __('String that separates tables into different tree levels.');
|
||||
$strConfigNavigationTreeTableSeparator_name = __('Table tree separator');
|
||||
$strConfigNavigationTreeTableLevel_name = __('Maximum table tree depth');
|
||||
$strConfigNavigationTreePointerEnable_desc
|
||||
= __('Highlight server under the mouse cursor.');
|
||||
$strConfigNavigationTreePointerEnable_name = __('Enable highlighting');
|
||||
$strConfigNavigationTreeEnableExpansion_desc = __(
|
||||
'Whether to offer the possibility of tree expansion in the navigation panel.'
|
||||
);
|
||||
$strConfigNavigationTreeEnableExpansion_name
|
||||
= __('Enable navigation tree expansion');
|
||||
$strConfigNavigationTreeShowTables_name = __('Show tables in tree');
|
||||
$strConfigNavigationTreeShowTables_desc
|
||||
= __('Whether to show tables under database in the navigation tree');
|
||||
$strConfigNavigationTreeShowViews_name = __('Show views in tree');
|
||||
$strConfigNavigationTreeShowViews_desc
|
||||
= __('Whether to show views under database in the navigation tree');
|
||||
$strConfigNavigationTreeShowFunctions_name = __('Show functions in tree');
|
||||
$strConfigNavigationTreeShowFunctions_desc
|
||||
= __('Whether to show functions under database in the navigation tree');
|
||||
$strConfigNavigationTreeShowProcedures_name = __('Show procedures in tree');
|
||||
$strConfigNavigationTreeShowProcedures_desc
|
||||
= __('Whether to show procedures under database in the navigation tree');
|
||||
$strConfigNavigationTreeShowEvents_name = __('Show events in tree');
|
||||
$strConfigNavigationTreeShowEvents_desc
|
||||
= __('Whether to show events under database in the navigation tree');
|
||||
$strConfigNumRecentTables_desc
|
||||
= __('Maximum number of recently used tables; set 0 to disable.');
|
||||
$strConfigNumFavoriteTables_desc
|
||||
= __('Maximum number of favorite tables; set 0 to disable.');
|
||||
$strConfigNumRecentTables_name = __('Recently used tables');
|
||||
$strConfigNumFavoriteTables_name = __('Favorite tables');
|
||||
$strConfigRowActionLinks_desc = __('These are Edit, Copy and Delete links.');
|
||||
$strConfigRowActionLinks_name = __('Where to show the table row links');
|
||||
$strConfigRowActionLinksWithoutUnique_desc = __(
|
||||
'Whether to show row links even in the absence of a unique key.'
|
||||
);
|
||||
$strConfigRowActionLinksWithoutUnique_name = __('Show row links anyway');
|
||||
$strConfigNaturalOrder_desc
|
||||
= __('Use natural order for sorting table and database names.');
|
||||
$strConfigNaturalOrder_name = __('Natural order');
|
||||
$strConfigTableNavigationLinksMode_desc = __('Use only icons, only text or both.');
|
||||
$strConfigTableNavigationLinksMode_name = __('Table navigation bar');
|
||||
$strConfigOBGzip_desc
|
||||
= __('Use GZip output buffering for increased speed in HTTP transfers.');
|
||||
$strConfigOBGzip_name = __('GZip output buffering');
|
||||
$strConfigOrder_desc = __(
|
||||
'[kbd]SMART[/kbd] - i.e. descending order for columns of type TIME, DATE, '
|
||||
. 'DATETIME and TIMESTAMP, ascending order otherwise.'
|
||||
);
|
||||
$strConfigOrder_name = __('Default sorting order');
|
||||
$strConfigPersistentConnections_desc
|
||||
= __('Use persistent connections to MySQL databases.');
|
||||
$strConfigPersistentConnections_name = __('Persistent connections');
|
||||
$strConfigPmaNoRelation_DisableWarning_desc = __(
|
||||
'Disable the default warning that is displayed on the database details '
|
||||
. 'Structure page if any of the required tables for the phpMyAdmin '
|
||||
. 'configuration storage could not be found.'
|
||||
);
|
||||
$strConfigPmaNoRelation_DisableWarning_name
|
||||
= __('Missing phpMyAdmin configuration storage tables');
|
||||
$strConfigServerLibraryDifference_DisableWarning_desc = __(
|
||||
'Disable the default warning that is displayed if a difference between the '
|
||||
. 'MySQL library and server is detected.'
|
||||
);
|
||||
$strConfigServerLibraryDifference_DisableWarning_name
|
||||
= __('Server/library difference warning');
|
||||
$strConfigReservedWordDisableWarning_desc = __(
|
||||
'Disable the default warning that is displayed on the Structure page if column '
|
||||
. 'names in a table are reserved MySQL words.'
|
||||
);
|
||||
$strConfigReservedWordDisableWarning_name = __('MySQL reserved word warning');
|
||||
$strConfigTabsMode_desc = __('Use only icons, only text or both.');
|
||||
$strConfigTabsMode_name = __('How to display the menu tabs');
|
||||
$strConfigActionLinksMode_desc = __('Use only icons, only text or both.');
|
||||
$strConfigActionLinksMode_name = __('How to display various action links');
|
||||
$strConfigProtectBinary_desc = __('Disallow BLOB and BINARY columns from editing.');
|
||||
$strConfigProtectBinary_name = __('Protect binary columns');
|
||||
$strConfigQueryHistoryDB_desc = __(
|
||||
'Enable if you want DB-based query history (requires phpMyAdmin configuration '
|
||||
. 'storage). If disabled, this utilizes JS-routines to display query history '
|
||||
. '(lost by window close).'
|
||||
);
|
||||
$strConfigQueryHistoryDB_name = __('Permanent query history');
|
||||
$strConfigQueryHistoryMax_cmt = __('Users cannot set a higher value');
|
||||
$strConfigQueryHistoryMax_desc = __('How many queries are kept in history.');
|
||||
$strConfigQueryHistoryMax_name = __('Query history length');
|
||||
$strConfigRecodingEngine_desc
|
||||
= __('Select which functions will be used for character set conversion.');
|
||||
$strConfigRecodingEngine_name = __('Recoding engine');
|
||||
$strConfigRememberSorting_desc
|
||||
= __('When browsing tables, the sorting of each table is remembered.');
|
||||
$strConfigRememberSorting_name = __('Remember table\'s sorting');
|
||||
$strConfigTablePrimaryKeyOrder_desc = __(
|
||||
'Default sort order for tables with a primary key.'
|
||||
);
|
||||
$strConfigTablePrimaryKeyOrder_name = __('Primary key default sort order');
|
||||
$strConfigRepeatCells_desc
|
||||
= __('Repeat the headers every X cells, [kbd]0[/kbd] deactivates this feature.');
|
||||
$strConfigRepeatCells_name = __('Repeat headers');
|
||||
$strConfigRestoreDefaultValue = __('Restore default value');
|
||||
$strConfigGridEditing_name = __('Grid editing: trigger action');
|
||||
$strConfigRelationalDisplay_name = __('Relational display');
|
||||
$strConfigRelationalDisplay_desc = __('For display Options');
|
||||
$strConfigSaveCellsAtOnce_name = __('Grid editing: save all edited cells at once');
|
||||
$strConfigSaveDir_desc = __('Directory where exports can be saved on server.');
|
||||
$strConfigSaveDir_name = __('Save directory');
|
||||
$strConfigServers_AllowDeny_order_desc = __('Leave blank if not used.');
|
||||
$strConfigServers_AllowDeny_order_name = __('Host authorization order');
|
||||
$strConfigServers_AllowDeny_rules_desc = __('Leave blank for defaults.');
|
||||
$strConfigServers_AllowDeny_rules_name = __('Host authorization rules');
|
||||
$strConfigServers_AllowNoPassword_name = __('Allow logins without a password');
|
||||
$strConfigServers_AllowRoot_name = __('Allow root login');
|
||||
$strConfigServers_SessionTimeZone_name = __('Session timezone');
|
||||
$strConfigServers_SessionTimeZone_desc = __(
|
||||
'Sets the effective timezone; possibly different than the one from your ' .
|
||||
'database server'
|
||||
);
|
||||
$strConfigServers_auth_http_realm_desc
|
||||
= __('HTTP Basic Auth Realm name to display when doing HTTP Auth.');
|
||||
$strConfigServers_auth_http_realm_name = __('HTTP Realm');
|
||||
$strConfigServers_auth_type_desc = __('Authentication method to use.');
|
||||
$strConfigServers_auth_type_name = __('Authentication type');
|
||||
$strConfigServers_bookmarktable_desc = __(
|
||||
'Leave blank for no [doc@bookmarks@]bookmark[/doc] '
|
||||
. 'support, suggested: [kbd]pma__bookmark[/kbd]'
|
||||
);
|
||||
$strConfigServers_bookmarktable_name = __('Bookmark table');
|
||||
$strConfigServers_column_info_desc = __(
|
||||
'Leave blank for no column comments/mime types, suggested: '
|
||||
. '[kbd]pma__column_info[/kbd].'
|
||||
);
|
||||
$strConfigServers_column_info_name = __('Column information table');
|
||||
$strConfigServers_compress_desc = __('Compress connection to MySQL server.');
|
||||
$strConfigServers_compress_name = __('Compress connection');
|
||||
$strConfigServers_connect_type_desc
|
||||
= __('How to connect to server, keep [kbd]tcp[/kbd] if unsure.');
|
||||
$strConfigServers_connect_type_name = __('Connection type');
|
||||
$strConfigServers_controlpass_name = __('Control user password');
|
||||
$strConfigServers_controluser_desc = __(
|
||||
'A special MySQL user configured with limited permissions, more information '
|
||||
. 'available on [doc@linked-tables]documentation[/doc].'
|
||||
);
|
||||
$strConfigServers_controluser_name = __('Control user');
|
||||
$strConfigServers_controlhost_desc = __(
|
||||
'An alternate host to hold the configuration storage; leave blank to use the '
|
||||
. 'already defined host.'
|
||||
);
|
||||
$strConfigServers_controlhost_name = __('Control host');
|
||||
$strConfigServers_controlport_desc = __(
|
||||
'An alternate port to connect to the host that holds the configuration storage; '
|
||||
. 'leave blank to use the default port, or the already defined port, if the '
|
||||
. 'controlhost equals host.'
|
||||
);
|
||||
$strConfigServers_controlport_name = __('Control port');
|
||||
$strConfigServers_hide_db_desc
|
||||
= __('Hide databases matching regular expression (PCRE).');
|
||||
$strConfigServers_DisableIS_desc = __(
|
||||
'More information on [a@https://sourceforge.net/p/phpmyadmin/bugs/2606/]PMA ' .
|
||||
'bug tracker[/a] and [a@https://bugs.mysql.com/19588]MySQL Bugs[/a]'
|
||||
);
|
||||
$strConfigServers_DisableIS_name = __('Disable use of INFORMATION_SCHEMA');
|
||||
$strConfigServers_hide_db_name = __('Hide databases');
|
||||
$strConfigServers_history_desc = __(
|
||||
'Leave blank for no SQL query history support, suggested: '
|
||||
. '[kbd]pma__history[/kbd].'
|
||||
);
|
||||
$strConfigServers_history_name = __('SQL query history table');
|
||||
$strConfigServers_host_desc = __('Hostname where MySQL server is running.');
|
||||
$strConfigServers_host_name = __('Server hostname');
|
||||
$strConfigServers_LogoutURL_name = __('Logout URL');
|
||||
$strConfigServers_MaxTableUiprefs_desc = __(
|
||||
'Limits number of table preferences which are stored in database, the oldest '
|
||||
. 'records are automatically removed.'
|
||||
);
|
||||
$strConfigServers_MaxTableUiprefs_name
|
||||
= __('Maximal number of table preferences to store');
|
||||
$strConfigServers_savedsearches_name = __('QBE saved searches table');
|
||||
$strConfigServers_savedsearches_desc = __(
|
||||
'Leave blank for no QBE saved searches support, suggested: '
|
||||
. '[kbd]pma__savedsearches[/kbd].'
|
||||
);
|
||||
$strConfigServers_export_templates_name = __('Export templates table');
|
||||
$strConfigServers_export_templates_desc = __(
|
||||
'Leave blank for no export template support, suggested: '
|
||||
. '[kbd]pma__export_templates[/kbd].'
|
||||
);
|
||||
$strConfigServers_central_columns_name = __('Central columns table');
|
||||
$strConfigServers_central_columns_desc = __(
|
||||
'Leave blank for no central columns support, suggested: '
|
||||
. '[kbd]pma__central_columns[/kbd].'
|
||||
);
|
||||
$strConfigServers_nopassword_desc = __('Try to connect without password.');
|
||||
$strConfigServers_nopassword_name = __('Connect without password');
|
||||
$strConfigServers_only_db_desc = __(
|
||||
'You can use MySQL wildcard characters (% and _), escape them if you want to '
|
||||
. 'use their literal instances, i.e. use [kbd]\'my\_db\'[/kbd] and not '
|
||||
. '[kbd]\'my_db\'[/kbd].'
|
||||
);
|
||||
$strConfigServers_only_db_name = __('Show only listed databases');
|
||||
$strConfigServers_password_desc = __('Leave empty if not using config auth.');
|
||||
$strConfigServers_password_name = __('Password for config auth');
|
||||
$strConfigServers_pdf_pages_desc = __(
|
||||
'Leave blank for no PDF schema support, suggested: [kbd]pma__pdf_pages[/kbd].'
|
||||
);
|
||||
$strConfigServers_pdf_pages_name = __('PDF schema: pages table');
|
||||
$strConfigServers_pmadb_desc = __(
|
||||
'Database used for relations, bookmarks, and PDF features. See '
|
||||
. '[doc@linked-tables]pmadb[/doc] for complete information. '
|
||||
. 'Leave blank for no support. Suggested: [kbd]phpmyadmin[/kbd].'
|
||||
);
|
||||
$strConfigServers_pmadb_name = __('Database name');
|
||||
$strConfigServers_port_desc
|
||||
= __('Port on which MySQL server is listening, leave empty for default.');
|
||||
$strConfigServers_port_name = __('Server port');
|
||||
$strConfigServers_recent_desc = __(
|
||||
'Leave blank for no "persistent" recently used tables across sessions, '
|
||||
. 'suggested: [kbd]pma__recent[/kbd].'
|
||||
);
|
||||
$strConfigServers_recent_name = __('Recently used table');
|
||||
$strConfigServers_favorite_desc = __(
|
||||
'Leave blank for no "persistent" favorite tables across sessions, '
|
||||
. 'suggested: [kbd]pma__favorite[/kbd].'
|
||||
);
|
||||
$strConfigServers_favorite_name = __('Favorites table');
|
||||
$strConfigServers_relation_desc = __(
|
||||
'Leave blank for no '
|
||||
. '[doc@relations@]relation-links[/doc] support, '
|
||||
. 'suggested: [kbd]pma__relation[/kbd].'
|
||||
);
|
||||
$strConfigServers_relation_name = __('Relation table');
|
||||
$strConfigServers_SignonSession_desc = __(
|
||||
'See [doc@authentication-modes]authentication '
|
||||
. 'types[/doc] for an example.'
|
||||
);
|
||||
$strConfigServers_SignonSession_name = __('Signon session name');
|
||||
$strConfigServers_SignonURL_name = __('Signon URL');
|
||||
$strConfigServers_socket_desc
|
||||
= __('Socket on which MySQL server is listening, leave empty for default.');
|
||||
$strConfigServers_socket_name = __('Server socket');
|
||||
$strConfigServers_ssl_desc = __('Enable SSL for connection to MySQL server.');
|
||||
$strConfigServers_ssl_name = __('Use SSL');
|
||||
$strConfigServers_table_coords_desc = __(
|
||||
'Leave blank for no PDF schema support, suggested: [kbd]pma__table_coords[/kbd].'
|
||||
);
|
||||
$strConfigServers_table_coords_name = __(
|
||||
'Designer and PDF schema: table coordinates'
|
||||
);
|
||||
$strConfigServers_table_info_desc = __(
|
||||
'Table to describe the display columns, leave blank for no support; '
|
||||
. 'suggested: [kbd]pma__table_info[/kbd].'
|
||||
);
|
||||
$strConfigServers_table_info_name = __('Display columns table');
|
||||
$strConfigServers_table_uiprefs_desc = __(
|
||||
'Leave blank for no "persistent" tables\' UI preferences across sessions, '
|
||||
. 'suggested: [kbd]pma__table_uiprefs[/kbd].'
|
||||
);
|
||||
$strConfigServers_table_uiprefs_name = __('UI preferences table');
|
||||
$strConfigServers_tracking_add_drop_database_desc = __(
|
||||
'Whether a DROP DATABASE IF EXISTS statement will be added as first line to '
|
||||
. 'the log when creating a database.'
|
||||
);
|
||||
$strConfigServers_tracking_add_drop_database_name = __('Add DROP DATABASE');
|
||||
$strConfigServers_tracking_add_drop_table_desc = __(
|
||||
'Whether a DROP TABLE IF EXISTS statement will be added as first line to the '
|
||||
. 'log when creating a table.'
|
||||
);
|
||||
$strConfigServers_tracking_add_drop_table_name = __('Add DROP TABLE');
|
||||
$strConfigServers_tracking_add_drop_view_desc = __(
|
||||
'Whether a DROP VIEW IF EXISTS statement will be added as first line to the '
|
||||
. 'log when creating a view.'
|
||||
);
|
||||
$strConfigServers_tracking_add_drop_view_name = __('Add DROP VIEW');
|
||||
$strConfigServers_tracking_default_statements_desc
|
||||
= __('Defines the list of statements the auto-creation uses for new versions.');
|
||||
$strConfigServers_tracking_default_statements_name = __('Statements to track');
|
||||
$strConfigServers_tracking_desc = __(
|
||||
'Leave blank for no SQL query tracking support, suggested: '
|
||||
. '[kbd]pma__tracking[/kbd].'
|
||||
);
|
||||
$strConfigServers_tracking_name = __('SQL query tracking table');
|
||||
$strConfigServers_tracking_version_auto_create_desc = __(
|
||||
'Whether the tracking mechanism creates versions for tables and views '
|
||||
. 'automatically.'
|
||||
);
|
||||
$strConfigServers_tracking_version_auto_create_name
|
||||
= __('Automatically create versions');
|
||||
$strConfigServers_userconfig_desc = __(
|
||||
'Leave blank for no user preferences storage in database, suggested: ' .
|
||||
'[kbd]pma__userconfig[/kbd].'
|
||||
);
|
||||
$strConfigServers_userconfig_name = __('User preferences storage table');
|
||||
$strConfigServers_users_desc = __(
|
||||
'Both this table and the user groups table are required to enable the ' .
|
||||
'configurable menus feature; leaving either one of them blank will disable ' .
|
||||
'this feature, suggested: [kbd]pma__users[/kbd].'
|
||||
);
|
||||
$strConfigServers_users_name = __('Users table');
|
||||
$strConfigServers_usergroups_desc = __(
|
||||
'Both this table and the users table are required to enable the configurable ' .
|
||||
'menus feature; leaving either one of them blank will disable this feature, ' .
|
||||
'suggested: [kbd]pma__usergroups[/kbd].'
|
||||
);
|
||||
$strConfigServers_usergroups_name = __('User groups table');
|
||||
$strConfigServers_navigationhiding_desc = __(
|
||||
'Leave blank to disable the feature to hide and show navigation items, ' .
|
||||
'suggested: [kbd]pma__navigationhiding[/kbd].'
|
||||
);
|
||||
$strConfigServers_navigationhiding_name = __('Hidden navigation items table');
|
||||
$strConfigServers_user_desc = __('Leave empty if not using config auth.');
|
||||
$strConfigServers_user_name = __('User for config auth');
|
||||
$strConfigServers_verbose_desc = __(
|
||||
'A user-friendly description of this server. Leave blank to display the ' .
|
||||
'hostname instead.'
|
||||
);
|
||||
$strConfigServers_verbose_name = __('Verbose name of this server');
|
||||
$strConfigShowAll_desc = __(
|
||||
'Whether a user should be displayed a "show all (rows)" button.'
|
||||
);
|
||||
$strConfigShowAll_name = __('Allow to display all the rows');
|
||||
$strConfigShowChgPassword_desc = __(
|
||||
'Please note that enabling this has no effect with [kbd]config[/kbd] ' .
|
||||
'authentication mode because the password is hard coded in the configuration ' .
|
||||
'file; this does not limit the ability to execute the same command directly.'
|
||||
);
|
||||
$strConfigShowChgPassword_name = __('Show password change form');
|
||||
$strConfigShowCreateDb_name = __('Show create database form');
|
||||
$strConfigShowDbStructureComment_desc = __(
|
||||
'Show or hide a column displaying the comments for all tables.'
|
||||
);
|
||||
$strConfigShowDbStructureComment_name = __('Show table comments');
|
||||
$strConfigShowDbStructureCreation_desc = __(
|
||||
'Show or hide a column displaying the Creation timestamp for all tables.'
|
||||
);
|
||||
$strConfigShowDbStructureCreation_name = __('Show creation timestamp');
|
||||
$strConfigShowDbStructureLastUpdate_desc = __(
|
||||
'Show or hide a column displaying the Last update timestamp for all tables.'
|
||||
);
|
||||
$strConfigShowDbStructureLastUpdate_name = __('Show last update timestamp');
|
||||
$strConfigShowDbStructureLastCheck_desc = __(
|
||||
'Show or hide a column displaying the Last check timestamp for all tables.'
|
||||
);
|
||||
$strConfigShowDbStructureLastCheck_name = __('Show last check timestamp');
|
||||
$strConfigShowFieldTypesInDataEditView_desc = __(
|
||||
'Defines whether or not type fields should be initially displayed in ' .
|
||||
'edit/insert mode.'
|
||||
);
|
||||
$strConfigShowFieldTypesInDataEditView_name = __('Show field types');
|
||||
$strConfigShowFunctionFields_desc = __(
|
||||
'Display the function fields in edit/insert mode.'
|
||||
);
|
||||
$strConfigShowFunctionFields_name = __('Show function fields');
|
||||
$strConfigShowHint_desc = __('Whether to show hint or not.');
|
||||
$strConfigShowHint_name = __('Show hint');
|
||||
$strConfigShowServerInfo_name = __('Show detailed MySQL server information');
|
||||
$strConfigShowSQL_desc = __(
|
||||
'Defines whether SQL queries generated by phpMyAdmin should be displayed.'
|
||||
);
|
||||
$strConfigShowSQL_name = __('Show SQL queries');
|
||||
$strConfigRetainQueryBox_desc = __(
|
||||
'Defines whether the query box should stay on-screen after its submission.'
|
||||
);
|
||||
$strConfigRetainQueryBox_name = __('Retain query box');
|
||||
$strConfigShowStats_desc = __(
|
||||
'Allow to display database and table statistics (eg. space usage).'
|
||||
);
|
||||
$strConfigShowStats_name = __('Show statistics');
|
||||
$strConfigSkipLockedTables_desc = __(
|
||||
'Mark used tables and make it possible to show databases with locked tables.'
|
||||
);
|
||||
$strConfigSkipLockedTables_name = __('Skip locked tables');
|
||||
$strConfigSQLQuery_Edit_name = __('Edit');
|
||||
$strConfigSQLQuery_Explain_name = __('Explain SQL');
|
||||
$strConfigSQLQuery_Refresh_name = __('Refresh');
|
||||
$strConfigSQLQuery_ShowAsPHP_name = __('Create PHP code');
|
||||
$strConfigSuhosinDisableWarning_desc = __(
|
||||
'Disable the default warning that is displayed on the main page if Suhosin is ' .
|
||||
'detected.'
|
||||
);
|
||||
$strConfigSuhosinDisableWarning_name = __('Suhosin warning');
|
||||
$strConfigLoginCookieValidityDisableWarning_desc = __(
|
||||
'Disable the default warning that is displayed on the main page if the value ' .
|
||||
'of the PHP setting session.gc_maxlifetime is less than the value of ' .
|
||||
'`LoginCookieValidity`.'
|
||||
);
|
||||
$strConfigLoginCookieValidityDisableWarning_name = __(
|
||||
'Login cookie validity warning'
|
||||
);
|
||||
$strConfigTextareaCols_desc = __(
|
||||
'Textarea size (columns) in edit mode, this value will be emphasized for SQL ' .
|
||||
'query textareas (*2).'
|
||||
);
|
||||
$strConfigTextareaCols_name = __('Textarea columns');
|
||||
$strConfigTextareaRows_desc = __(
|
||||
'Textarea size (rows) in edit mode, this value will be emphasized for SQL ' .
|
||||
'query textareas (*2).'
|
||||
);
|
||||
$strConfigTextareaRows_name = __('Textarea rows');
|
||||
$strConfigTitleDatabase_desc = __(
|
||||
'Title of browser window when a database is selected.'
|
||||
);
|
||||
$strConfigTitleDatabase_name = __('Database');
|
||||
$strConfigTitleDefault_desc = __(
|
||||
'Title of browser window when nothing is selected.'
|
||||
);
|
||||
$strConfigTitleDefault_name = __('Default title');
|
||||
$strConfigTitleServer_desc = __(
|
||||
'Title of browser window when a server is selected.'
|
||||
);
|
||||
$strConfigTitleServer_name = __('Server');
|
||||
$strConfigTitleTable_desc = __('Title of browser window when a table is selected.');
|
||||
$strConfigTitleTable_name = __('Table');
|
||||
$strConfigTrustedProxies_desc = __(
|
||||
'Input proxies as [kbd]IP: trusted HTTP header[/kbd]. The following example ' .
|
||||
'specifies that phpMyAdmin should trust a HTTP_X_FORWARDED_FOR ' .
|
||||
'(X-Forwarded-For) header coming from the proxy 1.2.3.4:[br][kbd]1.2.3.4: ' .
|
||||
'HTTP_X_FORWARDED_FOR[/kbd].'
|
||||
);
|
||||
$strConfigTrustedProxies_name = __('List of trusted proxies for IP allow/deny');
|
||||
$strConfigUploadDir_desc = __(
|
||||
'Directory on server where you can upload files for import.'
|
||||
);
|
||||
$strConfigUploadDir_name = __('Upload directory');
|
||||
$strConfigUseDbSearch_desc = __('Allow for searching inside the entire database.');
|
||||
$strConfigUseDbSearch_name = __('Use database search');
|
||||
$strConfigUserprefsDeveloperTab_desc = __(
|
||||
'When disabled, users cannot set any of the options below, regardless of the ' .
|
||||
'checkbox on the right.'
|
||||
);
|
||||
$strConfigUserprefsDeveloperTab_name = __('Enable the Developer tab in settings');
|
||||
$strConfigVersionCheckLink = __('Check for latest version');
|
||||
$strConfigVersionCheck_desc = __(
|
||||
'Enables check for latest version on main phpMyAdmin page.'
|
||||
);
|
||||
$strConfigVersionCheck_name = __('Version check');
|
||||
$strConfigProxyUrl_desc = __(
|
||||
'The url of the proxy to be used when retrieving the information about the ' .
|
||||
'latest version of phpMyAdmin or when submitting error reports. You need this ' .
|
||||
'if the server where phpMyAdmin is installed does not have direct access to ' .
|
||||
'the internet. The format is: "hostname:portnumber".'
|
||||
);
|
||||
$strConfigProxyUrl_name = __('Proxy url');
|
||||
$strConfigProxyUser_desc = __(
|
||||
'The username for authenticating with the proxy. By default, no ' .
|
||||
'authentication is performed. If a username is supplied, Basic ' .
|
||||
'Authentication will be performed. No other types of authentication are ' .
|
||||
'currently supported.'
|
||||
);
|
||||
$strConfigProxyUser_name = __('Proxy username');
|
||||
$strConfigProxyPass_desc = __('The password for authenticating with the proxy.');
|
||||
$strConfigProxyPass_name = __('Proxy password');
|
||||
|
||||
$strConfigZipDump_desc = __(
|
||||
'Enable ZIP ' .
|
||||
'compression for import and export operations.'
|
||||
);
|
||||
$strConfigZipDump_name = __('ZIP');
|
||||
$strConfigCaptchaLoginPublicKey_desc = __(
|
||||
'Enter your public key for your domain reCaptcha service.'
|
||||
);
|
||||
$strConfigCaptchaLoginPublicKey_name = __('Public key for reCaptcha');
|
||||
$strConfigCaptchaLoginPrivateKey_desc = __(
|
||||
'Enter your private key for your domain reCaptcha service.'
|
||||
);
|
||||
$strConfigCaptchaLoginPrivateKey_name = __('Private key for reCaptcha');
|
||||
|
||||
$strConfigSendErrorReports_desc = __(
|
||||
'Choose the default action when sending error reports.'
|
||||
);
|
||||
$strConfigSendErrorReports_name = __('Send error reports');
|
||||
|
||||
$strConfigConsoleEnterExecutes_desc = __(
|
||||
'Queries are executed by pressing Enter (instead of Ctrl+Enter). New lines ' .
|
||||
'will be inserted with Shift+Enter.'
|
||||
);
|
||||
$strConfigConsoleEnterExecutes_name = __('Enter executes queries in console');
|
||||
|
||||
$strConfigZeroConf_desc = __(
|
||||
'Enable Zero Configuration mode which lets you setup phpMyAdmin '
|
||||
. 'configuration storage tables automatically.'
|
||||
);
|
||||
$strConfigZeroConf_name = __('Enable Zero Configuration mode');
|
29
#pma/libraries/config/page_settings.forms.php
Normal file
29
#pma/libraries/config/page_settings.forms.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?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'];
|
395
#pma/libraries/config/setup.forms.php
Normal file
395
#pma/libraries/config/setup.forms.php
Normal file
@ -0,0 +1,395 @@
|
||||
<?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',
|
||||
'connect_type',
|
||||
'compress',
|
||||
'nopassword')));
|
||||
$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(
|
||||
'ServerLibraryDifference_DisableWarning',
|
||||
'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'
|
||||
);
|
||||
$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',
|
||||
'ShowChgPassword');
|
||||
$forms['Main_panel']['DbStructure'] = array(
|
||||
'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'));
|
298
#pma/libraries/config/user_preferences.forms.php
Normal file
298
#pma/libraries/config/user_preferences.forms.php
Normal file
@ -0,0 +1,298 @@
|
||||
<?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(
|
||||
'ServerLibraryDifference_DisableWarning',
|
||||
'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(
|
||||
'ShowDbStructureComment',
|
||||
'ShowDbStructureCreation',
|
||||
'ShowDbStructureLastUpdate',
|
||||
'ShowDbStructureLastCheck');
|
||||
$forms['Main_panel']['TableStructure'] = array(
|
||||
'HideStructureActions',
|
||||
'ShowColumnComments');
|
||||
$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');
|
Reference in New Issue
Block a user