Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2013-12-15 21:39:54 +01:00
commit d7d55b7c7c
11 changed files with 88 additions and 67 deletions

View File

@ -15,6 +15,9 @@ phpMyAdmin - ChangeLog
- bug #4149 Js freezes in the management of replication
- bug #3903 Query fails when using aliases after ordering result
- bug #4181 Adding columns in table creation clears existing columns
- bug #4023 Requires wildcard EXECUTE/ALTER ROUTINE on DB to allow
Procedures to be executed by user
- bug #4186 Adding a column when creating a table does not propagate index info
4.1.0.0 (2013-12-11)
+ rfe #499 On user creation, warn if the user already exists

View File

@ -165,7 +165,7 @@ class PMA_Error_Handler
case E_CORE_ERROR:
case E_COMPILE_ERROR:
default:
// FATAL error, dislay it and exit
// FATAL error, display it and exit
$this->dispFatalError($error);
exit;
break;

View File

@ -262,7 +262,8 @@ class PMA_StorageEngine
$res = $GLOBALS['dbi']->query($sql_query);
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
if (isset($variables[$row['Variable_name']])) {
$mysql_vars[$row['Variable_name']] = $variables[$row['Variable_name']];
$mysql_vars[$row['Variable_name']]
= $variables[$row['Variable_name']];
} elseif (! $like
&& strpos(strtolower($row['Variable_name']), strtolower($this->engine)) !== 0
) {

View File

@ -111,9 +111,12 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false,
if (! $sql_query_disabled) {
$sql_query .= $import_run_buffer['full'];
}
$pattern = '@^[[:space:]]*DROP[[:space:]]+(IF EXISTS[[:space:]]+)?'
. 'DATABASE @i';
if (! $cfg['AllowUserDropDatabase']
&& ! $is_superuser
&& preg_match('@^[[:space:]]*DROP[[:space:]]+(IF EXISTS[[:space:]]+)?DATABASE @i', $import_run_buffer['sql'])
&& preg_match($pattern, $import_run_buffer['sql'])
) {
$GLOBALS['message'] = PMA_Message::error(__('"DROP DATABASE" statements are disabled.'));
$error = true;
@ -121,12 +124,13 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false,
$executed_queries++;
$pattern = '/^[\s]*(SELECT|SHOW|HANDLER)/i';
if ($run_query
&& $GLOBALS['finished']
&& empty($sql)
&& ! $error
&& ((! empty($import_run_buffer['sql'])
&& preg_match('/^[\s]*(SELECT|SHOW|HANDLER)/i', $import_run_buffer['sql']))
&& preg_match($pattern, $import_run_buffer['sql']))
|| ($executed_queries == 1))
) {
$go_sql = true;
@ -219,8 +223,10 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false,
);
}
$pattern = '@^[\s]*(DROP|CREATE)[\s]+(IF EXISTS[[:space:]]+)'
. '?(TABLE|DATABASE)[[:space:]]+(.+)@im';
if ($result != false
&& preg_match('@^[\s]*(DROP|CREATE)[\s]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@im', $import_run_buffer['sql'])
&& preg_match($pattern, $import_run_buffer['sql'])
) {
$reload = true;
}

View File

@ -1,7 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Functions for the replication GUI
* Functions for the replication GUI
*
* @package PhpMyAdmin
*/
@ -905,25 +905,25 @@ function PMA_handleControlRequest()
$refresh = true;
switch ($_REQUEST['sr_slave_action']) {
case 'start':
$messageSuccess = __('Replication started successfully.');
$messageError = __('Error starting replication.');
break;
case 'start':
$messageSuccess = __('Replication started successfully.');
$messageError = __('Error starting replication.');
break;
case 'stop':
$messageSuccess = __('Replication stopped successfully.');
$messageError = __('Error stopping replication.');
break;
case 'stop':
$messageSuccess = __('Replication stopped successfully.');
$messageError = __('Error stopping replication.');
break;
case 'reset':
$messageSuccess = __('Replication resetting successfully.');
$messageError = __('Error resetting replication.');
break;
case 'reset':
$messageSuccess = __('Replication resetting successfully.');
$messageError = __('Error resetting replication.');
break;
default:
$messageSuccess = __('Success.');
$messageError = __('Error.');
break;
default:
$messageSuccess = __('Success.');
$messageError = __('Error.');
break;
}
} elseif (isset($_REQUEST['sr_slave_skip_error'])) {
$result = PMA_handleRequestForSlaveSkipError();
@ -935,7 +935,9 @@ function PMA_handleControlRequest()
$response->isSuccess($result);
$response->addJSON(
'message',
$result ? PMA_Message::success($messageSuccess) : PMA_Message::error($messageError)
$result
? PMA_Message::success($messageSuccess)
: PMA_Message::error($messageError)
);
} else {
PMA_sendHeaderLocation(
@ -1060,7 +1062,9 @@ function PMA_handleRequestForSlaveSkipError()
}
$qStop = PMA_Replication_Slave_control("STOP");
$qSkip = $GLOBALS['dbi']->tryQuery("SET GLOBAL SQL_SLAVE_SKIP_COUNTER = ".$count.";");
$qSkip = $GLOBALS['dbi']->tryQuery(
"SET GLOBAL SQL_SLAVE_SKIP_COUNTER = ".$count.";"
);
$qStart = PMA_Replication_Slave_control("START");
$result = ($qStop !== false && $qStop !== -1 &&

View File

@ -164,40 +164,43 @@ function PMA_RTN_getRowForList($routine, $rowclass = '')
}
$retval .= " </td>\n";
$retval .= " <td>\n";
if ($routine['ROUTINE_DEFINITION'] !== null
&& PMA_Util::currentUserHasPrivilege('EXECUTE', $db)
) {
// Check if he routine has any input parameters. If it does,
// we will show a dialog to get values for these parameters,
// otherwise we can execute it directly.
$routine_details = PMA_RTN_getDataFromName(
$routine['SPECIFIC_NAME'],
$routine['ROUTINE_TYPE'],
false
);
if ($routine !== false) {
$execute_action = 'execute_routine';
for ($i=0; $i<$routine_details['item_num_params']; $i++) {
if ($routine_details['item_type'] == 'PROCEDURE'
&& $routine_details['item_param_dir'][$i] == 'OUT'
) {
continue;
}
$execute_action = 'execute_dialog';
break;
// There is a problem with PMA_Util::currentUserHasPrivilege():
// it does not detect all kinds of privileges, for example
// a direct privilege on a specific routine. So, at this point,
// we show the Execute link, hoping that the user has the correct rights.
// Also, information_schema might be hiding the ROUTINE_DEFINITION
// but a routine with no input parameters can be nonetheless executed.
// Check if he routine has any input parameters. If it does,
// we will show a dialog to get values for these parameters,
// otherwise we can execute it directly.
$routine_details = PMA_RTN_getDataFromName(
$routine['SPECIFIC_NAME'],
$routine['ROUTINE_TYPE'],
false
);
if ($routine !== false) {
$execute_action = 'execute_routine';
for ($i=0; $i<$routine_details['item_num_params']; $i++) {
if ($routine_details['item_type'] == 'PROCEDURE'
&& $routine_details['item_param_dir'][$i] == 'OUT'
) {
continue;
}
$retval .= ' <a ' . $ajax_class['exec']
. ' href="db_routines.php?'
. $url_query
. '&amp;' . $execute_action . '=1'
. '&amp;item_name='
. urlencode($routine['SPECIFIC_NAME'])
. '&amp;' . $type_link
. '">' . $titles['Execute'] . "</a>\n";
$execute_action = 'execute_dialog';
break;
}
} else {
$retval .= " {$titles['NoExecute']}\n";
$retval .= ' <a ' . $ajax_class['exec']
. ' href="db_routines.php?'
. $url_query
. '&amp;' . $execute_action . '=1'
. '&amp;item_name='
. urlencode($routine['SPECIFIC_NAME'])
. '&amp;' . $type_link
. '">' . $titles['Execute'] . "</a>\n";
}
$retval .= " </td>\n";
$retval .= " <td>\n";
$retval .= ' <a ' . $ajax_class['export']

View File

@ -156,8 +156,11 @@ function PMA_langDetect($str, $envType)
if (strpos($expr, '[-_]') === false) {
$expr = str_replace('|', '([-_][[:alpha:]]{2,3})?|', $expr);
}
if (($envType == 1 && preg_match('/^(' . addcslashes($expr, '/') . ')(;q=[0-9]\\.[0-9])?$/i', $str))
|| ($envType == 2 && preg_match('/(\(|\[|;[[:space:]])(' . addcslashes($expr, '/') . ')(;|\]|\))/i', $str))
$pattern1 = '/^(' . addcslashes($expr, '/') . ')(;q=[0-9]\\.[0-9])?$/i';
$pattern2 = '/(\(|\[|;[[:space:]])(' . addcslashes($expr, '/')
. ')(;|\]|\))/i';
if (($envType == 1 && preg_match($pattern1, $str))
|| ($envType == 2 && preg_match($pattern2, $str))
) {
if (PMA_langSet($lang)) {
return true;
@ -430,9 +433,10 @@ function PMA_langList()
/* Process all files */
while (false !== ($file = readdir($handle))) {
$path = $GLOBALS['lang_path'] . '/' . $file . '/LC_MESSAGES/phpmyadmin.mo';
if ($file != "."
&& $file != ".."
&& file_exists($GLOBALS['lang_path'] . '/' . $file . '/LC_MESSAGES/phpmyadmin.mo')
&& file_exists($path)
) {
$result[$file] = PMA_langDetails($file);
}

View File

@ -381,7 +381,7 @@ function PMA_getRowDataForRegeneration($columnNumber, $submit_fulltext)
$columnMeta['Key'] = '';
if (isset($_REQUEST['field_key'][$columnNumber])) {
$parts = explode($_REQUEST['field_key'][$columnNumber], '_', 2);
$parts = explode('_', $_REQUEST['field_key'][$columnNumber], 2);
if (count($parts) == 2 && $parts[1] == $columnNumber) {
switch ($parts[0]) {
case 'primary':

View File

@ -9,7 +9,7 @@
/**
* Processes forms registered in $form_display, handles error correction
*
* @param FormDisplay $form_display
* @param FormDisplay $form_display Form
*
* @return void
*/

View File

@ -408,7 +408,7 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
{
$_REQUEST = array(
'field_name' => array(1 => 'name'),
'field_type' => array(0 => 'type'),
'field_type' => array(1 => 'type'),
'field_collation' => array(1 => 'colltn'),
'field_null' => array(1 => true),
'field_key' => array(1 => "fulltext_1"),
@ -424,10 +424,10 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
$this->assertEquals(
array(
'Field' => 'name',
'Type' => '',
'Type' => 'type',
'Collation' => 'colltn',
'Null' => '1',
'Key' => '',
'Null' => true,
'Key' => 'FULLTEXT',
'DefaultType' => 'USER_DEFINED',
'DefaultValue' => 'DEF',
'Default' => 'DEF',

View File

@ -222,9 +222,9 @@ function PMA_changePassAuthType($_url_params, $password)
/**
* Display the page
*
* @param string $message Message
* @param string $sql_query SQL query
* @param array $_url_params Parameters of URL
* @param string $message Message
* @param string $sql_query SQL query
* @param array $_url_params Parameters of URL
*
* @return void
*/