Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
185c9ecd0d
@ -199,8 +199,8 @@ class PMA_Config
|
||||
)) {
|
||||
$this->set('PMA_USR_BROWSER_VER', $log_version[1]);
|
||||
$this->set('PMA_USR_BROWSER_AGENT', 'OMNIWEB');
|
||||
// Konqueror 2.2.2 says Konqueror/2.2.2
|
||||
// Konqueror 3.0.3 says Konqueror/3
|
||||
// Konqueror 2.2.2 says Konqueror/2.2.2
|
||||
// Konqueror 3.0.3 says Konqueror/3
|
||||
} elseif (preg_match(
|
||||
'@(Konqueror/)(.*)(;)@',
|
||||
$HTTP_USER_AGENT,
|
||||
@ -208,10 +208,7 @@ class PMA_Config
|
||||
)) {
|
||||
$this->set('PMA_USR_BROWSER_VER', $log_version[2]);
|
||||
$this->set('PMA_USR_BROWSER_AGENT', 'KONQUEROR');
|
||||
} elseif (preg_match(
|
||||
'@Mozilla/([0-9].[0-9]{1,2})@',
|
||||
$HTTP_USER_AGENT,
|
||||
$log_version)
|
||||
} elseif (preg_match('@Mozilla/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)
|
||||
&& preg_match('@Safari/([0-9]*)@', $HTTP_USER_AGENT, $log_version2)
|
||||
) {
|
||||
$this->set('PMA_USR_BROWSER_VER', $log_version[1] . '.' . $log_version2[1]);
|
||||
@ -220,10 +217,8 @@ class PMA_Config
|
||||
$this->set('PMA_USR_BROWSER_VER', '1.9');
|
||||
$this->set('PMA_USR_BROWSER_AGENT', 'GECKO');
|
||||
} elseif (
|
||||
preg_match('@Mozilla/([0-9].[0-9]{1,2})@',
|
||||
$HTTP_USER_AGENT,
|
||||
$log_version
|
||||
)) {
|
||||
preg_match('@Mozilla/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)
|
||||
) {
|
||||
$this->set('PMA_USR_BROWSER_VER', $log_version[1]);
|
||||
$this->set('PMA_USR_BROWSER_AGENT', 'MOZILLA');
|
||||
} else {
|
||||
@ -595,8 +590,7 @@ class PMA_Config
|
||||
if ((! isset($config_data['collation_connection'])
|
||||
&& $GLOBALS['collation_connection'] != 'utf8_general_ci')
|
||||
|| isset($config_data['collation_connection'])
|
||||
&& $GLOBALS['collation_connection']
|
||||
!= $config_data['collation_connection']
|
||||
&& $GLOBALS['collation_connection'] != $config_data['collation_connection']
|
||||
) {
|
||||
$this->setUserValue(
|
||||
null,
|
||||
@ -627,7 +621,7 @@ class PMA_Config
|
||||
* by {@link loadUserPreferences()}
|
||||
*
|
||||
* @param string $cookie_name can be null
|
||||
* @param string $cfg_path
|
||||
* @param string $cfg_path configuration path
|
||||
* @param mixed $new_cfg_value new value
|
||||
* @param mixed $default_value default value
|
||||
*
|
||||
@ -682,7 +676,7 @@ class PMA_Config
|
||||
/**
|
||||
* set source
|
||||
*
|
||||
* @param string $source
|
||||
* @param string $source source
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
@ -724,7 +718,8 @@ class PMA_Config
|
||||
if (! is_readable($this->getSource())) {
|
||||
$this->source_mtime = 0;
|
||||
die(
|
||||
sprintf(__('Existing configuration file (%s) is not readable.'),
|
||||
sprintf(
|
||||
__('Existing configuration file (%s) is not readable.'),
|
||||
$this->getSource()
|
||||
)
|
||||
);
|
||||
@ -1220,10 +1215,11 @@ class PMA_Config
|
||||
/**
|
||||
* returns options for font size selection
|
||||
*
|
||||
* @static
|
||||
* @param string $current_size current selected font size with unit
|
||||
*
|
||||
* @return array selectable font sizes
|
||||
*
|
||||
* @static
|
||||
*/
|
||||
static protected function _getFontsizeOptions($current_size = '82%')
|
||||
{
|
||||
@ -1283,7 +1279,6 @@ class PMA_Config
|
||||
* returns html selectbox for font sizes
|
||||
*
|
||||
* @static
|
||||
* @param string $current_size currently slected font size with unit
|
||||
*
|
||||
* @return string html selectbox
|
||||
*/
|
||||
@ -1318,7 +1313,6 @@ class PMA_Config
|
||||
* return complete font size selection form
|
||||
*
|
||||
* @static
|
||||
* @param string $current_size currently slected font size with unit
|
||||
*
|
||||
* @return string html selectbox
|
||||
*/
|
||||
@ -1357,11 +1351,11 @@ class PMA_Config
|
||||
* sets cookie if value is different from current cokkie value,
|
||||
* or removes if value is equal to default
|
||||
*
|
||||
* @param string $cookie name of cookie to remove
|
||||
* @param mixed $value new cookie value
|
||||
* @param string $default default value
|
||||
* @param int $validity validity of cookie in seconds (default is one month)
|
||||
* @param bool $httponly whether cookie is only for HTTP (and not for scripts)
|
||||
* @param string $cookie name of cookie to remove
|
||||
* @param mixed $value new cookie value
|
||||
* @param string $default default value
|
||||
* @param int $validity validity of cookie in seconds (default is one month)
|
||||
* @param bool $httponly whether cookie is only for HTTP (and not for scripts)
|
||||
*
|
||||
* @return boolean result of setcookie()
|
||||
*/
|
||||
|
||||
@ -320,7 +320,8 @@ class Horde_Cipher_blowfish
|
||||
/**
|
||||
* Set the key to be used for en/decryption.
|
||||
*
|
||||
* @param string $key The key to use.
|
||||
* @param string $key The key to use.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setKey($key)
|
||||
@ -344,45 +345,45 @@ class Horde_Cipher_blowfish
|
||||
|
||||
$encZero = array('L' => 0, 'R' => 0);
|
||||
for ($i = 0; $i + 1 < $iMax; $i += 2) {
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->p[$i] = $encZero['L'];
|
||||
$this->p[$i + 1] = $encZero['R'];
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->p[$i] = $encZero['L'];
|
||||
$this->p[$i + 1] = $encZero['R'];
|
||||
}
|
||||
|
||||
$iMax = count($this->s1);
|
||||
for ($i = 0; $i < $iMax; $i += 2) {
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s1[$i] = $encZero['L'];
|
||||
$this->s1[$i + 1] = $encZero['R'];
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s1[$i] = $encZero['L'];
|
||||
$this->s1[$i + 1] = $encZero['R'];
|
||||
}
|
||||
|
||||
$iMax = count($this->s2);
|
||||
for ($i = 0; $i < $iMax; $i += 2) {
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s2[$i] = $encZero['L'];
|
||||
$this->s2[$i + 1] = $encZero['R'];
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s2[$i] = $encZero['L'];
|
||||
$this->s2[$i + 1] = $encZero['R'];
|
||||
}
|
||||
|
||||
$iMax = count($this->s3);
|
||||
for ($i = 0; $i < $iMax; $i += 2) {
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s3[$i] = $encZero['L'];
|
||||
$this->s3[$i + 1] = $encZero['R'];
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s3[$i] = $encZero['L'];
|
||||
$this->s3[$i + 1] = $encZero['R'];
|
||||
}
|
||||
|
||||
$iMax = count($this->s4);
|
||||
for ($i = 0; $i < $iMax; $i += 2) {
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s4[$i] = $encZero['L'];
|
||||
$this->s4[$i + 1] = $encZero['R'];
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s4[$i] = $encZero['L'];
|
||||
$this->s4[$i + 1] = $encZero['R'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypt a block of data.
|
||||
*
|
||||
* @param string $block The data to encrypt.
|
||||
* @param string $key The key to use.
|
||||
* @param string $block The data to encrypt.
|
||||
* @param string $key The key to use.
|
||||
*
|
||||
* @return string The encrypted output.
|
||||
*/
|
||||
@ -400,8 +401,8 @@ class Horde_Cipher_blowfish
|
||||
/**
|
||||
* Encrypt left and right halves of a block of data.
|
||||
*
|
||||
* @param integer $L Left half of the data.
|
||||
* @param integer $R Right half of the data.
|
||||
* @param integer $L Left half of the data.
|
||||
* @param integer $R Right half of the data.
|
||||
*
|
||||
* @return array A hash, with keys 'L' and 'R', and the encrypted data as
|
||||
* the values.
|
||||
@ -433,8 +434,8 @@ class Horde_Cipher_blowfish
|
||||
/**
|
||||
* Decrypt a block of data.
|
||||
*
|
||||
* @param string $block The data to decrypt.
|
||||
* @param string $key The key to use.
|
||||
* @param string $block The data to decrypt.
|
||||
* @param string $key The key to use.
|
||||
*
|
||||
* @return string The decrypted output.
|
||||
*/
|
||||
@ -444,7 +445,7 @@ class Horde_Cipher_blowfish
|
||||
$this->setKey($key);
|
||||
}
|
||||
|
||||
// change for phpMyAdmin
|
||||
// change for phpMyAdmin
|
||||
$L = null;
|
||||
$R = null;
|
||||
|
||||
@ -455,7 +456,7 @@ class Horde_Cipher_blowfish
|
||||
if (isset($retarray[1])) {
|
||||
$R = $retarray[1];
|
||||
}
|
||||
// end change for phpMyAdmin
|
||||
// end change for phpMyAdmin
|
||||
|
||||
$L ^= $this->p[17];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[16];
|
||||
@ -484,8 +485,8 @@ class Horde_Cipher_blowfish
|
||||
/**
|
||||
* Encryption using blowfish algorithm
|
||||
*
|
||||
* @param string original data
|
||||
* @param string the secret
|
||||
* @param string $data original data
|
||||
* @param string $secret the secret
|
||||
*
|
||||
* @return string the encrypted result
|
||||
*
|
||||
@ -512,8 +513,8 @@ function PMA_blowfish_encrypt($data, $secret)
|
||||
/**
|
||||
* Decryption using blowfish algorithm
|
||||
*
|
||||
* @param string encrypted data
|
||||
* @param string the secret
|
||||
* @param string $encdata encrypted data
|
||||
* @param string $secret the secret
|
||||
*
|
||||
* @return string original data
|
||||
*
|
||||
|
||||
@ -39,13 +39,13 @@ function PMA_Bookmark_getParams()
|
||||
/**
|
||||
* Gets the list of bookmarks defined for the current database
|
||||
*
|
||||
* @global resource the controluser db connection handle
|
||||
* @param string $db the current database name
|
||||
*
|
||||
* @param string the current database name
|
||||
* @return array the bookmarks list (key as index, label as value)
|
||||
*
|
||||
* @return array the bookmarks list (key as index, label as value)
|
||||
* @access public
|
||||
*
|
||||
* @access public
|
||||
* @global resource the controluser db connection handle
|
||||
*/
|
||||
function PMA_Bookmark_getList($db)
|
||||
{
|
||||
@ -84,17 +84,18 @@ function PMA_Bookmark_getList($db)
|
||||
/**
|
||||
* Gets the sql command from a bookmark
|
||||
*
|
||||
* @global resource the controluser db connection handle
|
||||
*
|
||||
* @param string the current database name
|
||||
* @param mixed the id of the bookmark to get
|
||||
* @param string which field to look up the $id
|
||||
* @param boolean true: get all bookmarks regardless of the owning user
|
||||
* @param boolean whether to ignore bookmarks with no user
|
||||
* @param string $db the current database name
|
||||
* @param mixed $id the id of the bookmark to get
|
||||
* @param string $id_field which field to look up the $id
|
||||
* @param boolean $action_bookmark_all true: get all bookmarks regardless of the owning user
|
||||
* @param boolean $exact_user_match whether to ignore bookmarks with no user
|
||||
*
|
||||
* @return string the sql query
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource the controluser db connection handle
|
||||
*
|
||||
*/
|
||||
function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = false, $exact_user_match = false)
|
||||
{
|
||||
@ -125,15 +126,15 @@ function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = fal
|
||||
/**
|
||||
* Adds a bookmark
|
||||
*
|
||||
* @global resource the controluser db connection handle
|
||||
*
|
||||
* @param array the properties of the bookmark to add; here,
|
||||
* $fields['query'] is urlencoded
|
||||
* @param boolean whether to make the bookmark available for all users
|
||||
* @param array $fields the properties of the bookmark to add; here,
|
||||
* $fields['query'] is urlencoded
|
||||
* @param boolean $all_users whether to make the bookmark available for all users
|
||||
*
|
||||
* @return boolean whether the INSERT succeeds or not
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource the controluser db connection handle
|
||||
*/
|
||||
function PMA_Bookmark_save($fields, $all_users = false)
|
||||
{
|
||||
@ -154,12 +155,14 @@ function PMA_Bookmark_save($fields, $all_users = false)
|
||||
/**
|
||||
* Deletes a bookmark
|
||||
*
|
||||
* @global resource the controluser db connection handle
|
||||
* @param string $db the current database name
|
||||
* @param integer $id the id of the bookmark to get
|
||||
*
|
||||
* @param string the current database name
|
||||
* @param integer the id of the bookmark to get
|
||||
* @return bool true if successful
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource the controluser db connection handle
|
||||
*/
|
||||
function PMA_Bookmark_delete($db, $id)
|
||||
{
|
||||
|
||||
@ -61,18 +61,20 @@ function PMA_getColumnOrder()
|
||||
* of databases from server_databases.php (which can be modified by
|
||||
* db_create.php)
|
||||
*
|
||||
* @param array $current
|
||||
* @param array $current
|
||||
* @param boolean $is_superuser
|
||||
* @param string $checkall
|
||||
* @param string $url_query
|
||||
* @param array $column_order
|
||||
* @param array $replication_types
|
||||
* @param array $replication_info
|
||||
* @param string $checkall
|
||||
* @param string $url_query
|
||||
* @param array $column_order
|
||||
* @param array $replication_types
|
||||
* @param array $replication_info
|
||||
*
|
||||
* @return array $column_order, $out
|
||||
*/
|
||||
function PMA_buildHtmlForDb($current, $is_superuser, $checkall, $url_query, $column_order, $replication_types, $replication_info)
|
||||
{
|
||||
function PMA_buildHtmlForDb(
|
||||
$current, $is_superuser, $checkall, $url_query,
|
||||
$column_order, $replication_types, $replication_info
|
||||
) {
|
||||
|
||||
$out = '';
|
||||
if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
|
||||
|
||||
@ -58,9 +58,9 @@ if ($PMA_recoding_engine == PMA_CHARSET_ICONV_AIX) {
|
||||
* Converts encoding of text according to parameters with detected
|
||||
* conversion function.
|
||||
*
|
||||
* @param string source charset
|
||||
* @param string target charset
|
||||
* @param string what to convert
|
||||
* @param string $src_charset source charset
|
||||
* @param string $dest_charset target charset
|
||||
* @param string $what what to convert
|
||||
*
|
||||
* @return string converted text
|
||||
*
|
||||
@ -73,14 +73,14 @@ function PMA_convert_string($src_charset, $dest_charset, $what)
|
||||
return $what;
|
||||
}
|
||||
switch ($GLOBALS['PMA_recoding_engine']) {
|
||||
case PMA_CHARSET_RECODE:
|
||||
return recode_string($src_charset . '..' . $dest_charset, $what);
|
||||
case PMA_CHARSET_ICONV:
|
||||
return iconv($src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what);
|
||||
case PMA_CHARSET_ICONV_AIX:
|
||||
return PMA_aix_iconv_wrapper($src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what);
|
||||
default:
|
||||
return $what;
|
||||
case PMA_CHARSET_RECODE:
|
||||
return recode_string($src_charset . '..' . $dest_charset, $what);
|
||||
case PMA_CHARSET_ICONV:
|
||||
return iconv($src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what);
|
||||
case PMA_CHARSET_ICONV_AIX:
|
||||
return PMA_aix_iconv_wrapper($src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what);
|
||||
default:
|
||||
return $what;
|
||||
}
|
||||
} // end of the "PMA_convert_string()" function
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@ $GLOBALS['is_superuser'] = PMA_isSuperuser();
|
||||
* displayed. For example, if an anonymous account exists, the named account
|
||||
* might be able to use its privileges, but SHOW GRANTS will not display them.
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_analyseShowGrant()
|
||||
{
|
||||
@ -62,9 +63,10 @@ function PMA_analyseShowGrant()
|
||||
while ($row = PMA_DBI_fetch_row($rs_usr)) {
|
||||
// extract db from GRANT ... ON *.* or GRANT ... ON db.*
|
||||
$db_name_offset = strpos($row[0], ' ON ') + 4;
|
||||
$show_grants_dbname = substr($row[0],
|
||||
$db_name_offset,
|
||||
strpos($row[0], '.', $db_name_offset) - $db_name_offset);
|
||||
$show_grants_dbname = substr(
|
||||
$row[0], $db_name_offset,
|
||||
strpos($row[0], '.', $db_name_offset) - $db_name_offset
|
||||
);
|
||||
$show_grants_dbname = PMA_unQuote($show_grants_dbname, '`');
|
||||
|
||||
$show_grants_str = substr($row[0], 6, (strpos($row[0], ' ON ') - 6));
|
||||
@ -77,9 +79,10 @@ function PMA_analyseShowGrant()
|
||||
* the create database dialog box
|
||||
*/
|
||||
if ($show_grants_str == 'ALL'
|
||||
|| $show_grants_str == 'ALL PRIVILEGES'
|
||||
|| $show_grants_str == 'CREATE'
|
||||
|| strpos($show_grants_str, 'CREATE,') !== false) {
|
||||
|| $show_grants_str == 'ALL PRIVILEGES'
|
||||
|| $show_grants_str == 'CREATE'
|
||||
|| strpos($show_grants_str, 'CREATE,') !== false
|
||||
) {
|
||||
if ($show_grants_dbname == '*') {
|
||||
// a global CREATE privilege
|
||||
$GLOBALS['is_create_db_priv'] = true;
|
||||
@ -101,14 +104,14 @@ function PMA_analyseShowGrant()
|
||||
}
|
||||
|
||||
if ((preg_match('/' . $re0 . '%|_/', $show_grants_dbname)
|
||||
&& ! preg_match('/\\\\%|\\\\_/', $show_grants_dbname))
|
||||
// does this db exist?
|
||||
|| (! PMA_DBI_try_query('USE ' . preg_replace('/' . $re1 . '(%|_)/', '\\1\\3', $dbname_to_test))
|
||||
&& substr(PMA_DBI_getError(), 1, 4) != 1044)
|
||||
&& ! preg_match('/\\\\%|\\\\_/', $show_grants_dbname))
|
||||
// does this db exist?
|
||||
|| (! PMA_DBI_try_query('USE ' . preg_replace('/' . $re1 . '(%|_)/', '\\1\\3', $dbname_to_test))
|
||||
&& substr(PMA_DBI_getError(), 1, 4) != 1044)
|
||||
) {
|
||||
if ($GLOBALS['cfg']['SuggestDBName']) {
|
||||
/**
|
||||
* Do not handle the underscore wildcard
|
||||
* Do not handle the underscore wildcard
|
||||
* (this case must be rare anyway)
|
||||
*/
|
||||
$GLOBALS['db_to_create'] = preg_replace('/' . $re0 . '%/', '\\1...', $show_grants_dbname);
|
||||
|
||||
@ -9,7 +9,8 @@
|
||||
/**
|
||||
* Removes all variables from request except whitelisted ones.
|
||||
*
|
||||
* @param string list of variables to allow
|
||||
* @param string &$whitelist list of variables to allow
|
||||
*
|
||||
* @return nothing
|
||||
* @access public
|
||||
*/
|
||||
|
||||
@ -75,7 +75,7 @@ if (version_compare(phpversion(), '5.3', 'lt')) {
|
||||
if (version_compare(phpversion(), '5.4', 'lt')) {
|
||||
/**
|
||||
* Avoid problems with magic_quotes_runtime
|
||||
*/
|
||||
*/
|
||||
@ini_set('magic_quotes_runtime', false);
|
||||
}
|
||||
|
||||
@ -242,7 +242,8 @@ if (isset($_POST['usesubform'])) {
|
||||
* track this
|
||||
*/
|
||||
if (isset($_POST['redirect'])
|
||||
&& $_POST['redirect'] != basename($PMA_PHP_SELF)) {
|
||||
&& $_POST['redirect'] != basename($PMA_PHP_SELF)
|
||||
) {
|
||||
$__redirect = $_POST['redirect'];
|
||||
unset($_POST['redirect']);
|
||||
}
|
||||
@ -321,8 +322,8 @@ $GLOBALS['PMA_Config']->enableBc();
|
||||
*/
|
||||
$pma_cookie_version = 4;
|
||||
if (isset($_COOKIE)
|
||||
&& (isset($_COOKIE['pmaCookieVer'])
|
||||
&& $_COOKIE['pmaCookieVer'] < $pma_cookie_version)) {
|
||||
&& (isset($_COOKIE['pmaCookieVer']) && $_COOKIE['pmaCookieVer'] < $pma_cookie_version)
|
||||
) {
|
||||
// delete all cookies
|
||||
foreach ($_COOKIE as $cookie_name => $tmp) {
|
||||
$GLOBALS['PMA_Config']->removeCookie($cookie_name);
|
||||
@ -336,11 +337,12 @@ if (isset($_COOKIE)
|
||||
* check HTTPS connection
|
||||
*/
|
||||
if ($GLOBALS['PMA_Config']->get('ForceSSL')
|
||||
&& !$GLOBALS['PMA_Config']->get('is_https')) {
|
||||
&& ! $GLOBALS['PMA_Config']->get('is_https')
|
||||
) {
|
||||
PMA_sendHeaderLocation(
|
||||
preg_replace('/^http/', 'https',
|
||||
$GLOBALS['PMA_Config']->get('PmaAbsoluteUri'))
|
||||
. PMA_generate_common_url($_GET, 'text'));
|
||||
preg_replace('/^http/', 'https', $GLOBALS['PMA_Config']->get('PmaAbsoluteUri'))
|
||||
. PMA_generate_common_url($_GET, 'text')
|
||||
);
|
||||
// delete the current session, otherwise we get problems (see bug #2397877)
|
||||
$GLOBALS['PMA_Config']->removeCookie($GLOBALS['session_name']);
|
||||
exit;
|
||||
@ -609,8 +611,10 @@ if ($GLOBALS['PMA_Config']->error_config_file) {
|
||||
trigger_error($error, E_USER_ERROR);
|
||||
}
|
||||
if ($GLOBALS['PMA_Config']->error_config_default_file) {
|
||||
$error = sprintf(__('Could not load default configuration from: %1$s'),
|
||||
$GLOBALS['PMA_Config']->default_source);
|
||||
$error = sprintf(
|
||||
__('Could not load default configuration from: %1$s'),
|
||||
$GLOBALS['PMA_Config']->default_source
|
||||
);
|
||||
trigger_error($error, E_USER_ERROR);
|
||||
}
|
||||
if ($GLOBALS['PMA_Config']->error_pma_uri) {
|
||||
@ -738,7 +742,8 @@ if (@file_exists($_SESSION['PMA_Theme']->getLayoutFile())) {
|
||||
* @todo remove if all themes are update use Navi instead of Left as frame name
|
||||
*/
|
||||
if (! isset($GLOBALS['cfg']['NaviWidth'])
|
||||
&& isset($GLOBALS['cfg']['LeftWidth'])) {
|
||||
&& isset($GLOBALS['cfg']['LeftWidth'])
|
||||
) {
|
||||
$GLOBALS['cfg']['NaviWidth'] = $GLOBALS['cfg']['LeftWidth'];
|
||||
}
|
||||
}
|
||||
@ -758,8 +763,10 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
* Lookup server by name
|
||||
* (see FAQ 4.8)
|
||||
*/
|
||||
if (! empty($_REQUEST['server']) && is_string($_REQUEST['server'])
|
||||
&& ! is_numeric($_REQUEST['server'])) {
|
||||
if (! empty($_REQUEST['server'])
|
||||
&& is_string($_REQUEST['server'])
|
||||
&& ! is_numeric($_REQUEST['server'])
|
||||
) {
|
||||
foreach ($cfg['Servers'] as $i => $server) {
|
||||
if ($server['host'] == $_REQUEST['server']) {
|
||||
$_REQUEST['server'] = $i;
|
||||
@ -799,7 +806,8 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
* Kanji encoding convert feature appended by Y.Kawada (2002/2/20)
|
||||
*/
|
||||
if (function_exists('mb_convert_encoding')
|
||||
&& $lang == 'ja') {
|
||||
&& $lang == 'ja'
|
||||
) {
|
||||
include_once './libraries/kanji-encoding.lib.php';
|
||||
} // end if
|
||||
|
||||
@ -859,7 +867,8 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
// http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/aaa/mod_access.c?rev=1.37&content-type=text/vnd.viewcvs-markup
|
||||
// Look at: "static int check_dir_access(request_rec *r)"
|
||||
if (isset($cfg['Server']['AllowDeny'])
|
||||
&& isset($cfg['Server']['AllowDeny']['order'])) {
|
||||
&& isset($cfg['Server']['AllowDeny']['order'])
|
||||
) {
|
||||
|
||||
/**
|
||||
* ip based access library
|
||||
@ -883,8 +892,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
$allowDeny_forbidden = false;
|
||||
}
|
||||
} elseif ($cfg['Server']['AllowDeny']['order'] == 'explicit') {
|
||||
if (PMA_allowDeny('allow')
|
||||
&& !PMA_allowDeny('deny')) {
|
||||
if (PMA_allowDeny('allow') && ! PMA_allowDeny('deny')) {
|
||||
$allowDeny_forbidden = false;
|
||||
} else {
|
||||
$allowDeny_forbidden = true;
|
||||
@ -927,19 +935,22 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
$controllink = false;
|
||||
if ($cfg['Server']['controluser'] != '') {
|
||||
if (! empty($cfg['Server']['controlhost'])) {
|
||||
$controllink = PMA_DBI_connect($cfg['Server']['controluser'],
|
||||
$controllink = PMA_DBI_connect(
|
||||
$cfg['Server']['controluser'],
|
||||
$cfg['Server']['controlpass'], true,
|
||||
array('host' => $cfg['Server']['controlhost'])
|
||||
);
|
||||
} else {
|
||||
$controllink = PMA_DBI_connect($cfg['Server']['controluser'],
|
||||
$cfg['Server']['controlpass'], true);
|
||||
$controllink = PMA_DBI_connect(
|
||||
$cfg['Server']['controluser'], $cfg['Server']['controlpass'], true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Connects to the server (validates user's login)
|
||||
$userlink = PMA_DBI_connect($cfg['Server']['user'],
|
||||
$cfg['Server']['password'], false);
|
||||
$userlink = PMA_DBI_connect(
|
||||
$cfg['Server']['user'], $cfg['Server']['password'], false
|
||||
);
|
||||
|
||||
if (! $controllink) {
|
||||
$controllink = $userlink;
|
||||
|
||||
@ -578,9 +578,10 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice')
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_mysqlDie($error_message = '', $the_query = '',
|
||||
$is_modify_link = true, $back_url = '', $exit = true)
|
||||
{
|
||||
function PMA_mysqlDie(
|
||||
$error_message = '', $the_query = '',
|
||||
$is_modify_link = true, $back_url = '', $exit = true
|
||||
) {
|
||||
global $table, $db;
|
||||
|
||||
/**
|
||||
@ -894,8 +895,8 @@ function PMA_backquote($a_name, $do_it = true)
|
||||
*
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $a_name the "backquoted" database, table or field name
|
||||
* or array of it
|
||||
* @param mixed $a_name the "backquoted" database, table or field name
|
||||
* or array of it
|
||||
*
|
||||
* @return mixed the "backquoted" database, table or field name
|
||||
*
|
||||
@ -946,6 +947,8 @@ function PMA_whichCrlf()
|
||||
*
|
||||
* @param bool $jsonly prints out pure JavaScript
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_reloadNavigation($jsonly=false)
|
||||
@ -1511,9 +1514,10 @@ function PMA_localizeNumber($value)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_formatNumber($value, $digits_left = 3, $digits_right = 0,
|
||||
$only_down = false, $noTrailingZero = true)
|
||||
{
|
||||
function PMA_formatNumber(
|
||||
$value, $digits_left = 3, $digits_right = 0,
|
||||
$only_down = false, $noTrailingZero = true
|
||||
) {
|
||||
if ($value==0) {
|
||||
return '0';
|
||||
}
|
||||
@ -1701,14 +1705,15 @@ function PMA_localisedDate($timestamp = -1, $format = '')
|
||||
* returns a tab for tabbed navigation.
|
||||
* If the variables $link and $args ar left empty, an inactive tab is created
|
||||
*
|
||||
* @param array $tab array with all options
|
||||
* @param array $url_params
|
||||
* @param array $tab array with all options
|
||||
* @param array $url_params
|
||||
* @param string $base_dir
|
||||
*
|
||||
* @return string html code for one tab, a link if valid otherwise a span
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_generate_html_tab($tab, $url_params = array(), $base_dir='')
|
||||
function PMA_generate_html_tab($tab, $url_params = array(), $base_dir = '')
|
||||
{
|
||||
// default values
|
||||
$defaults = array(
|
||||
@ -1812,7 +1817,7 @@ function PMA_generate_html_tab($tab, $url_params = array(), $base_dir='')
|
||||
*
|
||||
* @return string html-code for tab-navigation
|
||||
*/
|
||||
function PMA_generate_html_tabs($tabs, $url_params, $base_dir='', $menu_id='topmenu')
|
||||
function PMA_generate_html_tabs($tabs, $url_params, $base_dir = '', $menu_id = 'topmenu')
|
||||
{
|
||||
$tab_navigation = '<div id="' . htmlentities($menu_id) . 'container" class="menucontainer">'
|
||||
.'<ul id="' . htmlentities($menu_id) . '">';
|
||||
@ -1846,8 +1851,8 @@ function PMA_generate_html_tabs($tabs, $url_params, $base_dir='', $menu_id='topm
|
||||
* @return string the results to be echoed or saved in an array
|
||||
*/
|
||||
function PMA_linkOrButton($url, $message, $tag_params = array(),
|
||||
$new_form = true, $strip_img = false, $target = '')
|
||||
{
|
||||
$new_form = true, $strip_img = false, $target = ''
|
||||
) {
|
||||
$url_length = strlen($url);
|
||||
// with this we should be able to catch case of image upload
|
||||
// into a (MEDIUM) BLOB; not worth generating even a form for these
|
||||
@ -2074,6 +2079,8 @@ function PMA_flipstring($string, $Separator = "<br />\n")
|
||||
* until you know all needed parameters to check).
|
||||
* @param bool $request Whether to include this list in checking for special params.
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @global string path to current script
|
||||
* @global boolean flag whether any special variable was required
|
||||
*
|
||||
@ -2284,8 +2291,8 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force
|
||||
* @access public
|
||||
*/
|
||||
function PMA_buttonOrImage($button_name, $button_class, $image_name, $text,
|
||||
$image, $value = '')
|
||||
{
|
||||
$image, $value = ''
|
||||
) {
|
||||
if ($value == '') {
|
||||
$value = $text;
|
||||
}
|
||||
@ -2337,8 +2344,8 @@ function PMA_buttonOrImage($button_name, $button_class, $image_name, $text,
|
||||
*/
|
||||
function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1,
|
||||
$showAll = 200, $sliceStart = 5, $sliceEnd = 5, $percent = 20,
|
||||
$range = 10, $prompt = '')
|
||||
{
|
||||
$range = 10, $prompt = ''
|
||||
) {
|
||||
$increment = floor($nbTotalPage / $percent);
|
||||
$pageNowMinusRange = ($pageNow - $range);
|
||||
$pageNowPlusRange = ($pageNow + $range);
|
||||
@ -2394,20 +2401,20 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Add page numbers with "geometrically increasing" distances.
|
||||
/*
|
||||
Add page numbers with "geometrically increasing" distances.
|
||||
|
||||
This helps me a lot when navigating through giant tables.
|
||||
This helps me a lot when navigating through giant tables.
|
||||
|
||||
Test case: table with 2.28 million sets, 76190 pages. Page of interest is
|
||||
between 72376 and 76190.
|
||||
Selecting page 72376.
|
||||
Now, old version enumerated only +/- 10 pages around 72376 and the
|
||||
percentage increment produced steps of about 3000.
|
||||
Test case: table with 2.28 million sets, 76190 pages. Page of interest is
|
||||
between 72376 and 76190.
|
||||
Selecting page 72376.
|
||||
Now, old version enumerated only +/- 10 pages around 72376 and the
|
||||
percentage increment produced steps of about 3000.
|
||||
|
||||
The following code adds page numbers +/- 2,4,8,16,32,64,128,256 etc.
|
||||
around the current page.
|
||||
*/
|
||||
The following code adds page numbers +/- 2,4,8,16,32,64,128,256 etc.
|
||||
around the current page.
|
||||
*/
|
||||
|
||||
$i = $pageNow;
|
||||
$dist = 1;
|
||||
@ -2644,8 +2651,8 @@ function PMA_display_html_checkbox($html_field_name, $label, $checked, $onclick)
|
||||
* @return the HTML for the tadio buttons
|
||||
*/
|
||||
function PMA_display_html_radio($html_field_name, $choices, $checked_choice = '',
|
||||
$line_break = true, $escape_label = true, $class='')
|
||||
{
|
||||
$line_break = true, $escape_label = true, $class=''
|
||||
) {
|
||||
foreach ($choices as $choice_value => $choice_label) {
|
||||
if (! empty($class)) {
|
||||
echo '<div class="' . $class . '">';
|
||||
|
||||
@ -29,11 +29,13 @@
|
||||
* echo PMA_ifSetOr($cfg['ForceSSL'], false, 'boolean'); // true
|
||||
* </code>
|
||||
*
|
||||
* @see PMA_isValid()
|
||||
* @param mixed $var param to check
|
||||
* @param mixed $default default value
|
||||
* @param mixed $type var type or array of values to check against $var
|
||||
* @param mixed &$var param to check
|
||||
* @param mixed $default default value
|
||||
* @param mixed $type var type or array of values to check against $var
|
||||
*
|
||||
* @return mixed $var or $default
|
||||
*
|
||||
* @see PMA_isValid()
|
||||
*/
|
||||
function PMA_ifSetOr(&$var, $default = null, $type = 'similar')
|
||||
{
|
||||
@ -77,13 +79,15 @@ function PMA_ifSetOr(&$var, $default = null, $type = 'similar')
|
||||
*
|
||||
* to avoid this we set this var to null if not isset
|
||||
*
|
||||
* @param mixed &$var variable to check
|
||||
* @param mixed $type var type or array of valid values to check against $var
|
||||
* @param mixed $compare var to compare with $var
|
||||
*
|
||||
* @return boolean whether valid or not
|
||||
*
|
||||
* @todo create some testsuites
|
||||
* @todo add some more var types like hex, bin, ...?
|
||||
* @see http://php.net/gettype
|
||||
* @param mixed $var variable to check
|
||||
* @param mixed $type var type or array of valid values to check against $var
|
||||
* @param mixed $compare var to compare with $var
|
||||
* @return boolean whether valid or not
|
||||
*/
|
||||
function PMA_isValid(&$var, $type = 'length', $compare = null)
|
||||
{
|
||||
@ -104,24 +108,24 @@ function PMA_isValid(&$var, $type = 'length', $compare = null)
|
||||
// allow some aliaes of var types
|
||||
$type = strtolower($type);
|
||||
switch ($type) {
|
||||
case 'identic' :
|
||||
$type = 'identical';
|
||||
break;
|
||||
case 'len' :
|
||||
$type = 'length';
|
||||
break;
|
||||
case 'bool' :
|
||||
$type = 'boolean';
|
||||
break;
|
||||
case 'float' :
|
||||
$type = 'double';
|
||||
break;
|
||||
case 'int' :
|
||||
$type = 'integer';
|
||||
break;
|
||||
case 'null' :
|
||||
$type = 'NULL';
|
||||
break;
|
||||
case 'identic' :
|
||||
$type = 'identical';
|
||||
break;
|
||||
case 'len' :
|
||||
$type = 'length';
|
||||
break;
|
||||
case 'bool' :
|
||||
$type = 'boolean';
|
||||
break;
|
||||
case 'float' :
|
||||
$type = 'double';
|
||||
break;
|
||||
case 'int' :
|
||||
$type = 'integer';
|
||||
break;
|
||||
case 'null' :
|
||||
$type = 'NULL';
|
||||
break;
|
||||
}
|
||||
|
||||
if ($type === 'identical') {
|
||||
@ -131,16 +135,16 @@ function PMA_isValid(&$var, $type = 'length', $compare = null)
|
||||
// whether we should check against given $compare
|
||||
if ($type === 'similar') {
|
||||
switch (gettype($compare)) {
|
||||
case 'string':
|
||||
case 'boolean':
|
||||
$type = 'scalar';
|
||||
break;
|
||||
case 'integer':
|
||||
case 'double':
|
||||
$type = 'numeric';
|
||||
break;
|
||||
default:
|
||||
$type = gettype($compare);
|
||||
case 'string':
|
||||
case 'boolean':
|
||||
$type = 'scalar';
|
||||
break;
|
||||
case 'integer':
|
||||
case 'double':
|
||||
$type = 'numeric';
|
||||
break;
|
||||
default:
|
||||
$type = gettype($compare);
|
||||
}
|
||||
} elseif ($type === 'equal') {
|
||||
$type = gettype($compare);
|
||||
@ -171,7 +175,7 @@ function PMA_isValid(&$var, $type = 'length', $compare = null)
|
||||
* require() when a part of the path comes from an insecure source
|
||||
* like a cookie or form.
|
||||
*
|
||||
* @param string The path to check
|
||||
* @param string $path The path to check
|
||||
*
|
||||
* @return string The secured path
|
||||
*
|
||||
@ -191,10 +195,12 @@ function PMA_securePath($path)
|
||||
*
|
||||
* loads language file if not loaded already
|
||||
*
|
||||
* @todo use detected argument separator (PMA_Config)
|
||||
* @param string $error_message the error message or named error message
|
||||
* @param string|array $message_args arguments applied to $error_message
|
||||
* @param string $error_message the error message or named error message
|
||||
* @param string|array $message_args arguments applied to $error_message
|
||||
*
|
||||
* @return exit
|
||||
*
|
||||
* @todo use detected argument separator (PMA_Config)
|
||||
*/
|
||||
function PMA_fatalError($error_message, $message_args = null)
|
||||
{
|
||||
@ -233,7 +239,7 @@ function PMA_fatalError($error_message, $message_args = null)
|
||||
/**
|
||||
* Returns a link to the PHP documentation
|
||||
*
|
||||
* @param string anchor in documentation
|
||||
* @param string $target anchor in documentation
|
||||
*
|
||||
* @return string the URL
|
||||
*
|
||||
@ -256,8 +262,10 @@ function PMA_getPHPDocLink($target)
|
||||
* Warn or fail on missing extension.
|
||||
*
|
||||
* @param string $extension Extension name
|
||||
* @param bool $fatal Whether the error is fatal.
|
||||
/ @param string $extra Extra string to append to messsage.
|
||||
* @param bool $fatal Whether the error is fatal.
|
||||
* @param string $extra Extra string to append to messsage.
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_warnMissingExtension($extension, $fatal = false, $extra = '')
|
||||
{
|
||||
@ -267,8 +275,10 @@ function PMA_warnMissingExtension($extension, $fatal = false, $extra = '')
|
||||
} else {
|
||||
$message = 'The %s extension is missing. Please check your PHP configuration.';
|
||||
}
|
||||
$message = sprintf($message,
|
||||
'[a@' . PMA_getPHPDocLink('book.' . $extension . '.php') . '@Documentation][em]' . $extension . '[/em][/a]');
|
||||
$message = sprintf(
|
||||
$message,
|
||||
'[a@' . PMA_getPHPDocLink('book.' . $extension . '.php') . '@Documentation][em]' . $extension . '[/em][/a]'
|
||||
);
|
||||
if ($extra != '') {
|
||||
$message .= ' ' . $extra;
|
||||
}
|
||||
@ -282,14 +292,16 @@ function PMA_warnMissingExtension($extension, $fatal = false, $extra = '')
|
||||
/**
|
||||
* returns count of tables in given db
|
||||
*
|
||||
* @param string $db database to count tables for
|
||||
* @param string $db database to count tables for
|
||||
*
|
||||
* @return integer count of tables in $db
|
||||
*/
|
||||
function PMA_getTableCount($db)
|
||||
{
|
||||
$tables = PMA_DBI_try_query(
|
||||
'SHOW TABLES FROM ' . PMA_backquote($db) . ';',
|
||||
null, PMA_DBI_QUERY_STORE);
|
||||
null, PMA_DBI_QUERY_STORE
|
||||
);
|
||||
if ($tables) {
|
||||
$num_tables = PMA_DBI_num_rows($tables);
|
||||
PMA_DBI_free_result($tables);
|
||||
@ -306,8 +318,9 @@ function PMA_getTableCount($db)
|
||||
* (renamed with PMA prefix to avoid double definition when embedded
|
||||
* in Moodle)
|
||||
*
|
||||
* @param string $size
|
||||
* @return integer $size
|
||||
* @param string $size size
|
||||
*
|
||||
* @return integer $size
|
||||
*/
|
||||
function PMA_get_real_size($size = 0)
|
||||
{
|
||||
@ -325,7 +338,8 @@ function PMA_get_real_size($size = 0)
|
||||
|
||||
foreach ($scan as $unit => $factor) {
|
||||
if (strlen($size) > strlen($unit)
|
||||
&& strtolower(substr($size, strlen($size) - strlen($unit))) == $unit) {
|
||||
&& strtolower(substr($size, strlen($size) - strlen($unit))) == $unit
|
||||
) {
|
||||
return substr($size, 0, strlen($size) - strlen($unit)) * $factor;
|
||||
}
|
||||
}
|
||||
@ -339,65 +353,69 @@ function PMA_get_real_size($size = 0)
|
||||
*
|
||||
* array PMA_array_merge_recursive(array $array1[, array $array2[, array ...]])
|
||||
*
|
||||
* @see http://php.net/array_merge
|
||||
* @see http://php.net/array_merge_recursive
|
||||
* @param array array to merge
|
||||
* @param array array to merge
|
||||
* @param array ...
|
||||
*
|
||||
* @return array merged array
|
||||
*
|
||||
* @see http://php.net/array_merge
|
||||
* @see http://php.net/array_merge_recursive
|
||||
*/
|
||||
function PMA_array_merge_recursive()
|
||||
{
|
||||
switch(func_num_args()) {
|
||||
case 0 :
|
||||
return false;
|
||||
break;
|
||||
case 1 :
|
||||
// when does that happen?
|
||||
return func_get_arg(0);
|
||||
break;
|
||||
case 2 :
|
||||
$args = func_get_args();
|
||||
if (! is_array($args[0]) || ! is_array($args[1])) {
|
||||
return $args[1];
|
||||
}
|
||||
foreach ($args[1] as $key2 => $value2) {
|
||||
if (isset($args[0][$key2]) && !is_int($key2)) {
|
||||
$args[0][$key2] = PMA_array_merge_recursive($args[0][$key2],
|
||||
$value2);
|
||||
} else {
|
||||
// we erase the parent array, otherwise we cannot override a directive that
|
||||
// contains array elements, like this:
|
||||
// (in config.default.php) $cfg['ForeignKeyDropdownOrder'] = array('id-content','content-id');
|
||||
// (in config.inc.php) $cfg['ForeignKeyDropdownOrder'] = array('content-id');
|
||||
if (is_int($key2) && $key2 == 0) {
|
||||
unset($args[0]);
|
||||
}
|
||||
$args[0][$key2] = $value2;
|
||||
case 0 :
|
||||
return false;
|
||||
break;
|
||||
case 1 :
|
||||
// when does that happen?
|
||||
return func_get_arg(0);
|
||||
break;
|
||||
case 2 :
|
||||
$args = func_get_args();
|
||||
if (! is_array($args[0]) || ! is_array($args[1])) {
|
||||
return $args[1];
|
||||
}
|
||||
foreach ($args[1] as $key2 => $value2) {
|
||||
if (isset($args[0][$key2]) && !is_int($key2)) {
|
||||
$args[0][$key2] = PMA_array_merge_recursive($args[0][$key2], $value2);
|
||||
} else {
|
||||
// we erase the parent array, otherwise we cannot override a directive that
|
||||
// contains array elements, like this:
|
||||
// (in config.default.php) $cfg['ForeignKeyDropdownOrder'] = array('id-content','content-id');
|
||||
// (in config.inc.php) $cfg['ForeignKeyDropdownOrder'] = array('content-id');
|
||||
if (is_int($key2) && $key2 == 0) {
|
||||
unset($args[0]);
|
||||
}
|
||||
$args[0][$key2] = $value2;
|
||||
}
|
||||
return $args[0];
|
||||
break;
|
||||
default :
|
||||
$args = func_get_args();
|
||||
$args[1] = PMA_array_merge_recursive($args[0], $args[1]);
|
||||
array_shift($args);
|
||||
return call_user_func_array('PMA_array_merge_recursive', $args);
|
||||
break;
|
||||
}
|
||||
return $args[0];
|
||||
break;
|
||||
default :
|
||||
$args = func_get_args();
|
||||
$args[1] = PMA_array_merge_recursive($args[0], $args[1]);
|
||||
array_shift($args);
|
||||
return call_user_func_array('PMA_array_merge_recursive', $args);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* calls $function vor every element in $array recursively
|
||||
* calls $function for every element in $array recursively
|
||||
*
|
||||
* this function is protected against deep recursion attack CVE-2006-1549,
|
||||
* 1000 seems to be more than enough
|
||||
*
|
||||
* @param array &$array array to walk
|
||||
* @param string $function function to call for every array element
|
||||
* @param bool $apply_to_keys_also whether to call the function for the keys also
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see http://www.php-security.org/MOPB/MOPB-02-2007.html
|
||||
* @see http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-1549
|
||||
*
|
||||
* @param array $array array to walk
|
||||
* @param string $function function to call for every array element
|
||||
*/
|
||||
function PMA_arrayWalkRecursive(&$array, $function, $apply_to_keys_also = false)
|
||||
{
|
||||
@ -429,8 +447,9 @@ function PMA_arrayWalkRecursive(&$array, $function, $apply_to_keys_also = false)
|
||||
* checks given given $page against given $whitelist and returns true if valid
|
||||
* it ignores optionaly query paramters in $page (script.php?ignored)
|
||||
*
|
||||
* @param string &$page page to check
|
||||
* @param array $whitelist whitelist to check page against
|
||||
* @param string &$page page to check
|
||||
* @param array $whitelist whitelist to check page against
|
||||
*
|
||||
* @return boolean whether $page is valid or not (in $whitelist or not)
|
||||
*/
|
||||
function PMA_checkPageValidity(&$page, $whitelist)
|
||||
@ -458,7 +477,8 @@ function PMA_checkPageValidity(&$page, $whitelist)
|
||||
* searches in $_SERVER, $_ENV then tries getenv() and apache_getenv()
|
||||
* in this order
|
||||
*
|
||||
* @param string $var_name variable name
|
||||
* @param string $var_name variable name
|
||||
*
|
||||
* @return string value of $var or empty string
|
||||
*/
|
||||
function PMA_getenv($var_name)
|
||||
@ -480,7 +500,8 @@ function PMA_getenv($var_name)
|
||||
/**
|
||||
* Send HTTP header, taking IIS limits into account (600 seems ok)
|
||||
*
|
||||
* @param string $uri the header to send
|
||||
* @param string $uri the header to send
|
||||
*
|
||||
* @return boolean always true
|
||||
*/
|
||||
function PMA_sendHeaderLocation($uri)
|
||||
@ -593,9 +614,10 @@ function PMA_download_header($filename, $mimetype, $length = 0, $no_cache = true
|
||||
* $path is a string describing position of an element in an associative array,
|
||||
* eg. Servers/1/host refers to $array[Servers][1][host]
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $array
|
||||
* @param mixed $default
|
||||
* @param string $path path in the arry
|
||||
* @param array $array the array
|
||||
* @param mixed $default default value
|
||||
*
|
||||
* @return mixed array element or $default
|
||||
*/
|
||||
function PMA_array_read($path, $array, $default = null)
|
||||
@ -614,9 +636,11 @@ function PMA_array_read($path, $array, $default = null)
|
||||
/**
|
||||
* Stores value in an array
|
||||
*
|
||||
* @param string $path
|
||||
* @param array &$array
|
||||
* @param mixed $value
|
||||
* @param string $path path in the array
|
||||
* @param array &$array the array
|
||||
* @param mixed $value value to store
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_array_write($path, &$array, $value)
|
||||
{
|
||||
@ -635,9 +659,10 @@ function PMA_array_write($path, &$array, $value)
|
||||
/**
|
||||
* Removes value from an array
|
||||
*
|
||||
* @param string $path
|
||||
* @param array &$array
|
||||
* @param mixed $value
|
||||
* @param string $path path in the array
|
||||
* @param array &$array the array
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_array_remove($path, &$array)
|
||||
{
|
||||
@ -676,7 +701,7 @@ function PMA_array_remove($path, &$array)
|
||||
/**
|
||||
* Returns link to (possibly) external site using defined redirector.
|
||||
*
|
||||
* @param string $url URL where to go.
|
||||
* @param string $url URL where to go.
|
||||
*
|
||||
* @return string URL for a link.
|
||||
*/
|
||||
@ -716,6 +741,7 @@ function PMA_includeJS($url)
|
||||
*
|
||||
* @param string $str Js code to be added (e.g. "token=1234;")
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_AddJSCode($str)
|
||||
{
|
||||
@ -729,6 +755,7 @@ function PMA_AddJSCode($str)
|
||||
* @param mixed $value Value to set, can be either string or array of strings
|
||||
* @param bool $escape Whether to escape value or keep it as it is (for inclusion of js code)
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_AddJSVar($key, $value, $escape = true)
|
||||
{
|
||||
|
||||
@ -340,9 +340,10 @@ function PMA_usort_comparison_callback($a, $b)
|
||||
*
|
||||
* @return array list of tables in given db(s)
|
||||
*/
|
||||
function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = false, $link = null,
|
||||
$limit_offset = 0, $limit_count = false, $sort_by = 'Name', $sort_order = 'ASC')
|
||||
{
|
||||
function PMA_DBI_get_tables_full($database, $table = false,
|
||||
$tbl_is_group = false, $link = null, $limit_offset = 0,
|
||||
$limit_count = false, $sort_by = 'Name', $sort_order = 'ASC'
|
||||
) {
|
||||
if (true === $limit_count) {
|
||||
$limit_count = $GLOBALS['cfg']['MaxTableList'];
|
||||
}
|
||||
@ -663,8 +664,8 @@ function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = fals
|
||||
*/
|
||||
function PMA_DBI_get_databases_full($database = null, $force_stats = false,
|
||||
$link = null, $sort_by = 'SCHEMA_NAME', $sort_order = 'ASC',
|
||||
$limit_offset = 0, $limit_count = false)
|
||||
{
|
||||
$limit_offset = 0, $limit_count = false
|
||||
) {
|
||||
$sort_order = strtoupper($sort_order);
|
||||
|
||||
if (true === $limit_count) {
|
||||
@ -856,8 +857,8 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
|
||||
* @return array
|
||||
*/
|
||||
function PMA_DBI_get_columns_full($database = null, $table = null,
|
||||
$column = null, $link = null)
|
||||
{
|
||||
$column = null, $link = null
|
||||
) {
|
||||
$columns = array();
|
||||
|
||||
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
@ -1489,8 +1490,8 @@ function PMA_DBI_fetch_single_row($result, $type = 'ASSOC', $link = null)
|
||||
* @return array resultrows or values indexed by $key
|
||||
*/
|
||||
function PMA_DBI_fetch_result($result, $key = null, $value = null,
|
||||
$link = null, $options = 0)
|
||||
{
|
||||
$link = null, $options = 0
|
||||
) {
|
||||
$resultrows = array();
|
||||
|
||||
if (is_string($result)) {
|
||||
@ -1665,7 +1666,7 @@ function PMA_isSuperuser()
|
||||
* @param string $which PROCEDURE | FUNCTION
|
||||
* @param resource $link mysql link
|
||||
*
|
||||
* @returnarray the procedure names or function names
|
||||
* @return array the procedure names or function names
|
||||
*/
|
||||
function PMA_DBI_get_procedures_or_functions($db, $which, $link = null)
|
||||
{
|
||||
|
||||
@ -15,9 +15,10 @@ if (! defined('PHPMYADMIN')) {
|
||||
/**
|
||||
* copy values from one array to another, usually from a superglobal into $GLOBALS
|
||||
*
|
||||
* @param array $array values from
|
||||
* @param array &$target values to
|
||||
* @param bool $sanitize prevent importing key names in $_import_blacklist
|
||||
* @param array $array values from
|
||||
* @param array &$target values to
|
||||
* @param bool $sanitize prevent importing key names in $_import_blacklist
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function PMA_recursive_extract($array, &$target, $sanitize = true)
|
||||
@ -27,8 +28,9 @@ function PMA_recursive_extract($array, &$target, $sanitize = true)
|
||||
}
|
||||
|
||||
if ($sanitize) {
|
||||
$valid_variables = preg_replace($GLOBALS['_import_blacklist'], '',
|
||||
array_keys($array));
|
||||
$valid_variables = preg_replace(
|
||||
$GLOBALS['_import_blacklist'], '', array_keys($array)
|
||||
);
|
||||
$valid_variables = array_unique($valid_variables);
|
||||
} else {
|
||||
$valid_variables = array_keys($array);
|
||||
|
||||
@ -395,10 +395,20 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false)
|
||||
|
||||
/**
|
||||
* Displays on which column(s) a table-specific privilege is granted
|
||||
*
|
||||
* @param array $columns
|
||||
* @param array $row
|
||||
* @param string $name_for_select
|
||||
* @param string $priv_for_header
|
||||
* @param string $name
|
||||
* @param string $name_for_dfn
|
||||
* @param string $name_for_current
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_display_column_privs($columns, $row, $name_for_select,
|
||||
$priv_for_header, $name, $name_for_dfn, $name_for_current)
|
||||
{
|
||||
function PMA_displayColumnPrivs($columns, $row, $name_for_select,
|
||||
$priv_for_header, $name, $name_for_dfn, $name_for_current
|
||||
) {
|
||||
echo ' <div class="item" id="div_item_' . $name . '">' . "\n"
|
||||
. ' <label for="select_' . $name . '_priv">' . "\n"
|
||||
. ' <tt><dfn title="' . $name_for_dfn . '">'
|
||||
@ -559,22 +569,22 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true)
|
||||
|
||||
|
||||
// privs that are attached to a specific column
|
||||
PMA_display_column_privs(
|
||||
PMA_displayColumnPrivs(
|
||||
$columns, $row, 'Select_priv', 'SELECT',
|
||||
'select', __('Allows reading data.'), 'Select'
|
||||
);
|
||||
|
||||
PMA_display_column_privs(
|
||||
PMA_displayColumnPrivs(
|
||||
$columns, $row, 'Insert_priv', 'INSERT',
|
||||
'insert', __('Allows inserting and replacing data.'), 'Insert'
|
||||
);
|
||||
|
||||
PMA_display_column_privs(
|
||||
PMA_displayColumnPrivs(
|
||||
$columns, $row, 'Update_priv', 'UPDATE',
|
||||
'update', __('Allows changing data.'), 'Update'
|
||||
);
|
||||
|
||||
PMA_display_column_privs(
|
||||
PMA_displayColumnPrivs(
|
||||
$columns, $row, 'References_priv', 'REFERENCES', 'references',
|
||||
__('Has no effect in this MySQL version.'), 'References'
|
||||
);
|
||||
@ -583,8 +593,8 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true)
|
||||
|
||||
echo ' <div class="item">' . "\n";
|
||||
foreach ($row as $current_grant => $current_grant_value) {
|
||||
if (in_array(substr($current_grant, 0, (strlen($current_grant) - 5)),
|
||||
array('Select', 'Insert', 'Update', 'References'))) {
|
||||
$grant_type = substr($current_grant, 0, (strlen($current_grant) - 5));
|
||||
if (in_array($grant_type, array('Select', 'Insert', 'Update', 'References'))) {
|
||||
continue;
|
||||
}
|
||||
// make a substitution to match the messages variables;
|
||||
@ -820,13 +830,16 @@ function PMA_displayLoginInformationFields($mode = 'new')
|
||||
. ' </select>' . "\n"
|
||||
. '</span>' . "\n"
|
||||
. '<input type="text" name="username" maxlength="'
|
||||
. $username_length . '" title="' . __('User name') . '"'
|
||||
. (empty($GLOBALS['username'])
|
||||
? ''
|
||||
: ' value="' . htmlspecialchars(isset($GLOBALS['new_username'])
|
||||
? $GLOBALS['new_username']
|
||||
: $GLOBALS['username']) . '"')
|
||||
. ' onchange="pred_username.value = \'userdefined\';" />' . "\n"
|
||||
. $username_length . '" title="' . __('User name') . '"'
|
||||
. (empty($GLOBALS['username'])
|
||||
? ''
|
||||
: ' value="' . htmlspecialchars(
|
||||
isset($GLOBALS['new_username'])
|
||||
? $GLOBALS['new_username']
|
||||
: $GLOBALS['username']
|
||||
) . '"'
|
||||
)
|
||||
. ' onchange="pred_username.value = \'userdefined\';" />' . "\n"
|
||||
. '</div>' . "\n"
|
||||
. '<div class="item">' . "\n"
|
||||
. '<label for="select_pred_hostname">' . "\n"
|
||||
@ -928,12 +941,13 @@ function PMA_displayLoginInformationFields($mode = 'new')
|
||||
* Returns all the grants for a certain user on a certain host
|
||||
* Used in the export privileges for all users section
|
||||
*
|
||||
* @param string $user User name
|
||||
* @param string $host Host name
|
||||
* @param string $user User name
|
||||
* @param string $host Host name
|
||||
*
|
||||
* @return string containing all the grants text
|
||||
*/
|
||||
function PMA_getGrants($user, $host) {
|
||||
function PMA_getGrants($user, $host)
|
||||
{
|
||||
$grants = PMA_DBI_fetch_result("SHOW GRANTS FOR '" . PMA_sqlAddSlashes($user) . "'@'" . PMA_sqlAddSlashes($host) . "'");
|
||||
$response = '';
|
||||
foreach ($grants as $one_grant) {
|
||||
@ -1077,9 +1091,7 @@ if (isset($_REQUEST['adduser_submit']) || isset($_REQUEST['change_copy'])) {
|
||||
}
|
||||
|
||||
if ($_error || ! PMA_DBI_try_query($real_sql_query)) {
|
||||
$_REQUEST['createdb-1']
|
||||
= $_REQUEST['createdb-2']
|
||||
= $_REQUEST['createdb-3'] = false;
|
||||
$_REQUEST['createdb-1'] = $_REQUEST['createdb-2'] = $_REQUEST['createdb-3'] = false;
|
||||
$message = PMA_Message::rawError(PMA_DBI_getError());
|
||||
} else {
|
||||
$message = PMA_Message::success(__('You have added a new user.'));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user