Merge branch 'master' into Bug4537

Conflicts:
	ChangeLog
This commit is contained in:
Madhura Jayaratne 2014-10-06 14:25:17 +05:30
commit 13155b65a2
21 changed files with 108 additions and 165 deletions

View File

@ -46,6 +46,7 @@ phpMyAdmin - ChangeLog
+ rfe #1546 Improve the js printf library
+ rfe #1542 Better error reporting in Designer
- bug #4547 Micro history does not work in Users page
- bug #4551 Wrong test in source code
- bug #4537 BLOB inline-view JPG column transformation does not work for anything except simple queries
4.2.10.0 (not yet released)

View File

@ -45,7 +45,7 @@ if (isset($_REQUEST['operation'])) {
} elseif ($_REQUEST['operation'] == 'savePage') {
if ($_REQUEST['save_page'] == 'same') {
$page = $_REQUEST['selected_page'];
} elseif ($_REQUEST['save_page'] == 'new') {
} else { // new
$page = PMA_createNewPage($_REQUEST['selected_value'], $GLOBALS['db']);
$response->addJSON('id', $page);
}

View File

@ -29,6 +29,8 @@ $header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('db_operations.js');
$sql_query = '';
/**
* Rename/move or copy database
*/
@ -48,7 +50,6 @@ if ($pmaString->strlen($GLOBALS['db'])
) {
$message = PMA_Message::error(__('The database name is empty!'));
} else {
$sql_query = ''; // in case target db exists
$_error = false;
if ($move
|| (isset($_REQUEST['create_database_before_copying'])
@ -142,6 +143,8 @@ if ($pmaString->strlen($GLOBALS['db'])
);
$message->addParam($GLOBALS['db']);
$message->addParam($_REQUEST['newname']);
} else {
$message = PMA_Message::error();
}
$reload = true;
@ -158,10 +161,6 @@ if ($pmaString->strlen($GLOBALS['db'])
$GLOBALS['PMA_Config']->setCookie('pma_switch_to_new', '');
}
}
if ($_error && ! isset($message)) {
$message = PMA_Message::error();
}
}
/**

View File

@ -198,7 +198,6 @@ if ($server > 0 || count($cfg['Servers']) > 1
'select_collation_connection',
$collation_connection,
true,
4,
true
)
. ' </form>' . "\n"

View File

@ -346,8 +346,7 @@ $(function () {
);
// Update localStorage.
if (window.localStorage && window.localStorage !== undefined) {
window.localStorage.favorite_tables
= data.favorite_tables;
window.localStorage.favorite_tables = data.favorite_tables;
}
} else {
PMA_ajaxShowMessage(data.message);

View File

@ -350,9 +350,9 @@ function Re_load()
row_offset_top = document.getElementById(key2 + "." + key3).offsetTop;
}
var y1 = document.getElementById(key2).offsetTop
+ row_offset_top
+ height_field;
var y1 = document.getElementById(key2).offsetTop +
row_offset_top +
height_field;
//alert(1);
row_offset_top = 0;
@ -363,9 +363,9 @@ function Re_load()
}
var y2 =
document.getElementById(contr[K][key][key2][key3][0]).offsetTop
+ row_offset_top
+ height_field;
document.getElementById(contr[K][key][key2][key3][0]).offsetTop +
row_offset_top +
height_field;
//alert(y1 + ' - ' + key2 + "." + key3);
Line0(
@ -661,8 +661,8 @@ function Save3(callback)
.append('<input type="hidden" name="token" value="' + token + '" />')
.append('<input type="hidden" name="operation" value="savePage" />')
.append('<input type="hidden" name="save_page" value="new" />')
.append('<label for="selected_value">' + PMA_messages.strPageName
+ '</label>:<input type="text" name="selected_value" />');
.append('<label for="selected_value">' + PMA_messages.strPageName +
'</label>:<input type="text" name="selected_value" />');
$('<div id="page_save_dialog"></div>')
.append($form)
.dialog({

View File

@ -3989,7 +3989,7 @@ class PMA_DisplayResults
|| ($meta->type == self::DATETIME_FIELD)
|| ($meta->type == self::TIME_FIELD)
|| ($meta->type == self::TIME_FIELD))
&& ($pmaStr->strpos($column, ".") === true)
&& ($pmaStr->strpos($column, ".") !== false) // micro seconds delimeter
) {
$column = PMA_Util::addMicroseconds($column);
}

View File

@ -258,13 +258,11 @@ class PMA_TableSearch
* @param int $foreignMaxLimit Max limit of displaying foreign elements
* @param array $criteriaValues Array of search criteria inputs
* @param string $column_id Column's inputbox's id
* @param bool $in_zoom_search_edit Whether we are in zoom search edit
*
* @return string HTML elements.
*/
private function _getForeignKeyInputBox($foreignData, $column_name,
$column_index, $titles, $foreignMaxLimit, $criteriaValues, $column_id,
$in_zoom_search_edit = false
$column_index, $titles, $foreignMaxLimit, $criteriaValues, $column_id
) {
$html_output = '';
if (is_array($foreignData['disp_row'])) {
@ -532,14 +530,13 @@ EOT;
* @param mixed $criteriaValues Search criteria input
* @param string $names Name of the column on which search is submitted
* @param string $types Type of the field
* @param string $collations Field collation
* @param string $func_type Search function/operator
* @param bool $unaryFlag Whether operator unary or not
* @param bool $geom_func Whether geometry functions should be applied
*
* @return string generated where clause.
*/
private function _getWhereClause($criteriaValues, $names, $types, $collations,
private function _getWhereClause($criteriaValues, $names, $types,
$func_type, $unaryFlag, $geom_func = null
) {
// If geometry function is set
@ -705,14 +702,12 @@ EOT;
}
// else continue to form the where clause from column criteria values
$fullWhereClause = $charsets = array();
$fullWhereClause = array();
reset($_POST['criteriaColumnOperators']);
while (list($column_index, $operator) = each(
$_POST['criteriaColumnOperators']
)) {
list($charsets[$column_index]) = explode(
'_', $_POST['criteriaColumnCollations'][$column_index]
);
$unaryFlag = $GLOBALS['PMA_Types']->isUnaryOperator($operator);
$tmp_geom_func = isset($geom_func[$column_index])
? $geom_func[$column_index] : null;
@ -721,7 +716,6 @@ EOT;
$_POST['criteriaValues'][$column_index],
$_POST['criteriaColumnNames'][$column_index],
$_POST['criteriaColumnTypes'][$column_index],
$_POST['criteriaColumnCollations'][$column_index],
$operator,
$unaryFlag,
$tmp_geom_func

View File

@ -4431,7 +4431,7 @@ class PMA_Util
return $value;
}
if (!$pmaString->strpos($value, '.')) {
if ($pmaString->strpos($value, '.') === false) {
return $value . '.000000';
}

View File

@ -36,8 +36,7 @@ if ($is_create_db_priv) {
'db_collation',
null,
null,
true,
5
true
);
if (! empty($dbstats)) {

View File

@ -267,9 +267,19 @@ function PMA_analyzeTableColumnsArray($column, $comments_map, $timestamp_seen)
$column['True_Type'] = preg_replace('@\(.*@s', '', $column['Type']);
$column['len'] = preg_match('@float|double@', $column['Type']) ? 100 : -1;
$column['Field_title'] = PMA_getColumnTitle($column, $comments_map);
$column['is_binary'] = PMA_isColumnBinary($column);
$column['is_blob'] = PMA_isColumnBlob($column);
$column['is_char'] = PMA_isColumnChar($column);
$column['is_binary'] = PMA_isColumn(
$column,
array('binary', 'varbinary')
);
$column['is_blob'] = PMA_isColumn(
$column,
array('blob', 'tinyblob', 'mediumblob', 'longblob')
);
$column['is_char'] = PMA_isColumn(
$column,
array('char', 'varchar')
);
list($column['pma_type'], $column['wrap'], $column['first_timestamp'])
= PMA_getEnumSetAndTimestampColumns($column, $timestamp_seen);
@ -296,77 +306,28 @@ function PMA_getColumnTitle($column, $comments_map)
}
/**
* check whether the column is a binary
* check whether the column is of a certain type
* the goal is to ensure that types such as "enum('one','two','binary',..)"
* or "enum('one','two','varbinary',..)" are not categorized as binary
*
* @param array $column description of column in given table
* @param array $types the types to verify
*
* @return boolean If check to ensure types such as "enum('one','two','binary',..)"
* or "enum('one','two','varbinary',..)" are not categorized as
* binary.
* @return boolean whether the column's type if one of the $types
*/
function PMA_isColumnBinary($column)
function PMA_isColumn($column, $types)
{
/** @var PMA_String $pmaString */
$pmaString = $GLOBALS['PMA_String'];
// The type column.
// Fix for bug #3152931 'ENUM and SET cannot have "Binary" option'
if ($pmaString->stripos($column['Type'], 'binary') === 0
|| $pmaString->stripos($column['Type'], 'varbinary') === 0
) {
return stristr($column['Type'], 'binary');
} else {
return false;
foreach ($types as $one_type) {
if ($pmaString->stripos($column['Type'], $one_type) === 0) {
return true;
}
}
return false;
}
/**
* check whether the column is a blob
*
* @param array $column description of column in given table
*
* @return boolean If check to ensure types such as "enum('one','two','blob',..)"
* or "enum('one','two','tinyblob',..)" etc. are not categorized
* as blob.
*/
function PMA_isColumnBlob($column)
{
/** @var PMA_String $pmaString */
$pmaString = $GLOBALS['PMA_String'];
if ($pmaString->stripos($column['Type'], 'blob') === 0
|| $pmaString->stripos($column['Type'], 'tinyblob') === 0
|| $pmaString->stripos($column['Type'], 'mediumblob') === 0
|| $pmaString->stripos($column['Type'], 'longblob') === 0
) {
return stristr($column['Type'], 'blob');
} else {
return false;
}
}
/**
* check is table column char
*
* @param array $column description of column in given table
*
* @return boolean If check to ensure types such as "enum('one','two','char',..)" or
* "enum('one','two','varchar',..)" are not categorized as char.
*/
function PMA_isColumnChar($column)
{
/** @var PMA_String $pmaString */
$pmaString = $GLOBALS['PMA_String'];
if ($pmaString->stripos($column['Type'], 'char') === 0
|| $pmaString->stripos($column['Type'], 'varchar') === 0
) {
return stristr($column['Type'], 'char');
} else {
return false;
}
}
/**
* Retrieve set, enum, timestamp table columns
*
@ -1675,7 +1636,8 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow(
} elseif (($pmaString->substr($column['True_Type'], 0, 9) == 'timestamp'
|| $column['True_Type'] == 'datetime'
|| $column['True_Type'] == 'time')
&& ($pmaString->strpos($current_row[$column['Field']], ".") === true)
// micro seconds delimeter
&& ($pmaString->strpos($current_row[$column['Field']], ".") !== false)
) {
$current_row[$column['Field']] = $as_is
? $current_row[$column['Field']]

View File

@ -24,8 +24,8 @@ if (! defined('PHPMYADMIN')) {
* @return string
*/
function PMA_generateCharsetDropdownBox($type = PMA_CSDROPDOWN_COLLATION,
$name = null, $id = null, $default = null, $label = true, $indent = 0,
$submitOnChange = false, $displayUnavailable = false
$name = null, $id = null, $default = null, $label = true,
$submitOnChange = false
) {
global $mysql_charsets, $mysql_charsets_descriptions,
$mysql_charsets_available, $mysql_collations, $mysql_collations_available;

View File

@ -245,8 +245,7 @@ function PMA_getHtmlForChangeDatabaseCharset($db, $table)
'db_collation',
'select_db_collation',
isset($_REQUEST['db_collation']) ? $_REQUEST['db_collation'] : '',
false,
3
false
)
. '</fieldset>'
. '<fieldset class="tblFooters">'
@ -797,7 +796,7 @@ function PMA_getTableOptionFieldset($comment, $tbl_collation,
. '<td>'
. PMA_generateCharsetDropdownBox(
PMA_CSDROPDOWN_COLLATION,
'tbl_collation', null, $tbl_collation, false, 3
'tbl_collation', null, $tbl_collation, false
)
. '</td>'
. '</tr>';

View File

@ -100,7 +100,7 @@ function PMA_getHtmlForTableConfigurations()
? $_REQUEST['tbl_collation']
: null
),
false, 3
false
)
. '</td>'
. '</tr>';

View File

@ -170,14 +170,14 @@ function PMA_generateRelationalDropdown(
/**
* Function to get html for the common form
*
* @param string $db current database
* @param string $table current table
* @param array $columns columns
* @param array $cfgRelation configuration relation
* @param string $tbl_storage_engine table storage engine
* @param array|null $existrel db, table, column
* @param array|null $existrel_foreign db, table, column
* @param array $options_array options array
* @param string $db current database
* @param string $table current table
* @param array $columns columns
* @param array $cfgRelation configuration relation
* @param string $tbl_storage_engine table storage engine
* @param array $existrel db, table, column
* @param array $existrel_foreign db, table, column
* @param array $options_array options array
*
* @return string
*/

View File

@ -4,8 +4,8 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.3.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2014-10-02 11:40+0200\n"
"PO-Revision-Date: 2014-10-03 17:07+0200\n"
"Last-Translator: Xavier Navarro <xvnavarro@gmail.com>\n"
"PO-Revision-Date: 2014-10-05 19:43+0200\n"
"Last-Translator: josep constanti <jconstanti@ovi.com>\n"
"Language-Team: Catalan "
"<https://hosted.weblate.org/projects/phpmyadmin/master/ca/>\n"
"Language: ca\n"
@ -1022,7 +1022,7 @@ msgstr "Reinicia"
#: js/messages.php:53
#| msgid "Select All"
msgid "Reset All"
msgstr "Restableix Tot"
msgstr "Reinicia Tot"
#: js/messages.php:56
msgid "Missing value in the form!"
@ -5273,24 +5273,22 @@ msgstr "No s'ha pogut inicialitzar la biblioteca de connexió Drizzle!"
#: libraries/config/Validator.class.php:267
#: libraries/config/Validator.class.php:278
#: libraries/config/Validator.class.php:285
#, fuzzy
#| msgid "Could not connect to the target"
msgid "Could not connect to the database server!"
msgstr "No s'ha pogut connectar a la destinació"
msgstr "No s'ha pogut connectar amb el servidor de dades!"
#: libraries/config/Validator.class.php:317
#, fuzzy
#| msgid "Empty username while using config authentication method"
msgid "Empty username while using [kbd]config[/kbd] authentication method!"
msgstr "Nom d'usuari buit al usar el métode d'autenticació config"
msgstr "Nom d'usuari buit en usar el mètode d'autenticació [kbd]config[/kbd]!"
#: libraries/config/Validator.class.php:324
#, fuzzy
#| msgid "Empty signon session name while using signon authentication method"
msgid ""
"Empty signon session name while using [kbd]signon[/kbd] authentication "
"method!"
msgstr "Nom de sessió signon buit al usar el métode d'autenticació signon"
msgstr ""
"Nom de sessió signon buit en usar el mètode d'autenticació [kbd]signon[/kbd]!"
#: libraries/config/Validator.class.php:333
#, fuzzy

View File

@ -135,7 +135,10 @@ $url_params = PMA_urlParamsInEditMode(
$has_blob_field = false;
foreach ($table_columns as $column) {
if (PMA_isColumnBlob($column)) {
if (PMA_isColumn(
$column,
array('blob', 'tinyblob', 'mediumblob', 'longblob')
)) {
$has_blob_field = true;
break;
}

View File

@ -154,7 +154,7 @@ $columns = $GLOBALS['dbi']->getColumns($db, $table);
$html_output .= PMA_getHtmlForCommonForm(
$db, $table, $columns, $cfgRelation, $tbl_storage_engine,
isset($existrel) ? $existrel : array(),
isset($existrel_foreign) ? $existrel_foreign['foreign_keys_data'] : null,
isset($existrel_foreign) ? $existrel_foreign['foreign_keys_data'] : array(),
$options_array
);

View File

@ -451,69 +451,57 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
}
/**
* Test for PMA_isColumnBinary
* Test for PMA_isColumn
*
* @return void
*/
public function testIsColumnBinary()
public function testIsColumn()
{
$column = array();
$types = array('binary', 'varbinary');
$column['Type'] = 'binaryfoo';
$this->assertEquals('binaryfoo', PMA_isColumnBinary($column));
$this->assertTrue(PMA_isColumn($column, $types));
$column['Type'] = 'Binaryfoo';
$this->assertEquals('Binaryfoo', PMA_isColumnBinary($column));
$this->assertTrue(PMA_isColumn($column, $types));
$column['Type'] = 'varbinaryfoo';
$this->assertEquals('binaryfoo', PMA_isColumnBinary($column));
$this->assertTrue(PMA_isColumn($column, $types));
$column['Type'] = 'barbinaryfoo';
$this->assertFalse(PMA_isColumnBinary($column));
}
$this->assertFalse(PMA_isColumn($column, $types));
/**
* Test for PMA_isColumnBlob
*
* @return void
*/
public function testIsColumnBlob()
{
$column = array();
$column['Type'] = 'blob';
$this->assertEquals('blob', PMA_isColumnBlob($column));
$types = array('char', 'varchar');
$column['Type'] = 'bloB';
$this->assertEquals('bloB', PMA_isColumnBlob($column));
$column['Type'] = 'mediumBloB';
$this->assertEquals('BloB', PMA_isColumnBlob($column));
$column['Type'] = 'tinyblobabc';
$this->assertEquals('blobabc', PMA_isColumnBlob($column));
$column['Type'] = 'longblob';
$this->assertEquals('blob', PMA_isColumnBlob($column));
$column['Type'] = 'foolongblobbar';
$this->assertFalse(PMA_isColumnBlob($column));
}
/**
* Test for PMA_iscolumnchar
*
* @return void
*/
public function testIsColumnChar()
{
$column = array();
$column['Type'] = 'char(10)';
$this->assertEquals('char(10)', PMA_iscolumnchar($column));
$this->assertTrue(PMA_isColumn($column, $types));
$column['Type'] = 'VarChar(20)';
$this->assertEquals('Char(20)', PMA_iscolumnchar($column));
$this->assertTrue(PMA_isColumn($column, $types));
$column['Type'] = 'foochar';
$this->assertFalse(PMA_iscolumnchar($column));
$this->assertFalse(PMA_isColumn($column, $types));
$types = array('blob', 'tinyblob', 'mediumblob', 'longblob');
$column['Type'] = 'blob';
$this->assertTrue(PMA_isColumn($column, $types));
$column['Type'] = 'bloB';
$this->assertTrue(PMA_isColumn($column, $types));
$column['Type'] = 'mediumBloB';
$this->assertTrue(PMA_isColumn($column, $types));
$column['Type'] = 'tinyblobabc';
$this->assertTrue(PMA_isColumn($column, $types));
$column['Type'] = 'longblob';
$this->assertTrue(PMA_isColumn($column, $types));
$column['Type'] = 'foolongblobbar';
$this->assertFalse(PMA_isColumn($column, $types));
}
/**

View File

@ -284,7 +284,7 @@ class PMA_MySQL_Charsets_Test extends PHPUnit_Framework_TestCase
$this->assertContains('title="German', $result);
$result = PMA_generateCharsetDropdownBox(
2, null, "test_id", "latin1", false, 0, true, false
2, null, "test_id", "latin1", false, true
);
$this->assertContains('name="character_set"', $result);
$this->assertNotContains('Charset</option>', $result);

View File

@ -36,6 +36,8 @@ $view_security_options = array(
'INVOKER'
);
$sql_query = '';
if (isset($_REQUEST['createview']) || isset($_REQUEST['alterview'])) {
/**
* Creates the view