Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2013-04-12 18:49:11 +02:00
commit 49b4a117f0
33 changed files with 77 additions and 79 deletions

View File

@ -77,7 +77,7 @@ if (! empty($sql_query)) {
$ajax_reload['table_name'] = PMA_Util::unQuote($rename_table_names[2]);
$ajax_reload['reload'] = true;
}
$sql_query = '';
} elseif (! empty($sql_localfile)) {
// run SQL file on server
@ -565,7 +565,7 @@ if (strlen($sql_query) <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
// There was an error?
if (isset($my_die)) {
foreach ($my_die AS $key => $die) {
foreach ($my_die as $key => $die) {
PMA_Util::mysqlDie(
$die['error'], $die['sql'], '', $err_url, $error
);

View File

@ -612,7 +612,7 @@ class PMA_Config
} else {
$link = 'https://api.github.com/repos/phpmyadmin/phpmyadmin/git/commits/'
. $hash;
$is_found = $this->checkHTTP($link, !$commit);
$is_found = $this->checkHTTP($link, ! $commit);
switch($is_found) {
case false:
$is_remote_commit = false;
@ -721,7 +721,7 @@ class PMA_Config
}
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_NOBODY, !$get_body);
curl_setopt($ch, CURLOPT_NOBODY, ! $get_body);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

View File

@ -2656,7 +2656,7 @@ class PMA_DisplayResults
/**
* Get the values for one data row
* Get the values for one data row
*
* @param integer &$dt_result the link id associated to the query
* which results have to be displayed
@ -2696,8 +2696,8 @@ class PMA_DisplayResults
$row_info = $this->_getRowInfoForSpecialLinks($row, $col_order);
for ($currentColumn = 0;
$currentColumn < $this->__get('fields_cnt');
for ($currentColumn = 0;
$currentColumn < $this->__get('fields_cnt');
++$currentColumn) {
// assign $i with appropriate column order
@ -3462,7 +3462,7 @@ class PMA_DisplayResults
/**
* Get the combined classes for a column
* Get the combined classes for a column
*
* @param string $grid_edit_class the class for all editable columns
* @param string $not_null_class the class for not null columns
@ -4036,7 +4036,7 @@ class PMA_DisplayResults
list($col_order, $col_visib) = $this->_getColumnParams($analyzed_sql);
// Prepares data
foreach ($vertical_display['desc'] AS $j => $val) {
foreach ($vertical_display['desc'] as $j => $val) {
// assign appropriate key with current column order
$key = $col_order ? $col_order[$j] : $j;

View File

@ -661,7 +661,8 @@ class PMA_Index
. '</td>';
if (PMA_MYSQL_INT_VERSION > 50500
&& $column->getSeqInIndex() == 1) {
&& $column->getSeqInIndex() == 1
) {
$r .= '<td ' . $row_span . '>'
. htmlspecialchars($index->getComments()) . '</td>';
}

View File

@ -374,7 +374,7 @@ class PMA_Theme
global $cfg;
$css_string = '';
foreach ($cfg['SQP']['fmtColor'] AS $key => $col) {
foreach ($cfg['SQP']['fmtColor'] as $key => $col) {
$css_string .= $this->buildSQPCssRule('syntax_' . $key, 'color', $col);
}

View File

@ -122,9 +122,9 @@ function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = fal
. '.' . PMA_Util::backquote($cfgBookmark['table'])
. ' WHERE dbase = \'' . PMA_Util::sqlAddSlashes($db) . '\'';
if (!$action_bookmark_all) {
if (! $action_bookmark_all) {
$query .= ' AND (user = \'' . PMA_Util::sqlAddSlashes($cfgBookmark['user']) . '\'';
if (!$exact_user_match) {
if (! $exact_user_match) {
$query .= ' OR user = \'\'';
}
$query .= ')';

View File

@ -907,14 +907,14 @@ if (! defined('PMA_MINIMUM_COMMON')) {
} // end if
// is root allowed?
if (!$cfg['Server']['AllowRoot'] && $cfg['Server']['user'] == 'root') {
if (! $cfg['Server']['AllowRoot'] && $cfg['Server']['user'] == 'root') {
$allowDeny_forbidden = true;
PMA_log_user($cfg['Server']['user'], 'root-denied');
$auth_plugin->authFails();
}
// is a login without password allowed?
if (!$cfg['Server']['AllowNoPassword'] && $cfg['Server']['password'] == '') {
if (! $cfg['Server']['AllowNoPassword'] && $cfg['Server']['password'] == '') {
$login_without_password_is_forbidden = true;
PMA_log_user($cfg['Server']['user'], 'empty-denied');
$auth_plugin->authFails();

View File

@ -423,7 +423,7 @@ class ConfigFile
$dsn = $this->getValue("$path/extension") . '://';
if ($this->getValue("$path/auth_type") == 'config') {
$dsn .= $this->getValue("$path/user");
if (!$this->getValue("$path/nopassword")) {
if (! $this->getValue("$path/nopassword")) {
$dsn .= ':***';
}
$dsn .= '@';

View File

@ -105,7 +105,7 @@ class Form
}
$keys[] = is_bool($value[$i]) ? (int)$value[$i] : $value[$i];
}
if (!$has_string_keys) {
if (! $has_string_keys) {
$value = array_combine($keys, $value);
}
}

View File

@ -172,7 +172,7 @@ class FormDisplay
foreach ($errors as $path => $error_list) {
$work_path = array_search($path, $this->_systemPaths);
// field error
if (!$work_path) {
if (! $work_path) {
// form error, fix path
$work_path = $path;
}
@ -219,7 +219,7 @@ class FormDisplay
break;
}
}
if (!$is_new_server) {
if (! $is_new_server) {
$this->_validate();
}
@ -274,7 +274,7 @@ class FormDisplay
PMA_displayFormBottom();
// if not already done, send strings used for valdiation to JavaScript
if (!$js_lang_sent) {
if (! $js_lang_sent) {
$js_lang_sent = true;
$js_lang = array();
foreach ($this->_jsLangStrings as $strName => $strValue) {

View File

@ -30,7 +30,7 @@ function PMA_displayFormTop($action = null, $method = 'post', $hidden_fields = n
echo '<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) {
if (! $has_check_page_refresh) {
$has_check_page_refresh = true;
echo '<input type="hidden" name="check_page_refresh" '
. ' id="check_page_refresh" value="" />' . "\n";
@ -352,7 +352,7 @@ function PMA_displayGroupHeader($header_text)
global $_FormDisplayGroup;
$_FormDisplayGroup++;
if (!$header_text) {
if (! $header_text) {
return;
}
$colspan = defined('PMA_SETUP')

View File

@ -114,10 +114,10 @@ function PMA_config_validate($validator_id, &$values, $isPostSource)
if (is_array($r)) {
foreach ($r as $key => $error_list) {
// skip empty values if $isPostSource is false
if (!$isPostSource && empty($error_list)) {
if (! $isPostSource && empty($error_list)) {
continue;
}
if (!isset($result[$key])) {
if (! isset($result[$key])) {
$result[$key] = array();
}
$result[$key] = array_merge($result[$key], (array)$error_list);
@ -210,7 +210,7 @@ function test_db_connection(
if ($extension == 'drizzle') {
while (1) {
$drizzle = @drizzle_create();
if (!$drizzle) {
if (! $drizzle) {
$error = __('Could not initialize Drizzle connection library');
break;
}
@ -219,7 +219,7 @@ function test_db_connection(
: @drizzle_con_add_tcp(
$drizzle, $host, $port, $user, $pass, null, 0
);
if (!$conn) {
if (! $conn) {
$error = __('Could not connect to Drizzle server');
drizzle_free($drizzle);
break;
@ -227,7 +227,7 @@ function test_db_connection(
// connection object is set up but we have to send some query
// to actually connect
$res = @drizzle_query($conn, 'SELECT 1');
if (!$res) {
if (! $res) {
$error = __('Could not connect to Drizzle server');
} else {
drizzle_result_free($res);
@ -238,14 +238,14 @@ function test_db_connection(
}
} else if ($extension == 'mysql') {
$conn = @mysql_connect($host . $socket . $port, $user, $pass);
if (!$conn) {
if (! $conn) {
$error = __('Could not connect to MySQL server');
} else {
mysql_close($conn);
}
} else {
$conn = @mysqli_connect($host, $user, $pass, null, $port, $socket);
if (!$conn) {
if (! $conn) {
$error = __('Could not connect to MySQL server');
} else {
mysqli_close($conn);
@ -299,7 +299,7 @@ function validate_server($path, $values)
$error = true;
}
if (!$error && $values['Servers/1/auth_type'] == 'config') {
if (! $error && $values['Servers/1/auth_type'] == 'config') {
$password = $values['Servers/1/nopassword'] ? null
: $values['Servers/1/password'];
$test = test_db_connection(
@ -351,7 +351,7 @@ function validate_pmadb($path, $values)
= __('Empty phpMyAdmin control user password while using pmadb');
$error = true;
}
if (!$error) {
if (! $error) {
$test = test_db_connection(
$values['Servers/1/extension'], $values['Servers/1/connect_type'],
$values['Servers/1/host'], $values['Servers/1/port'],
@ -474,8 +474,8 @@ function test_number(
}
if (intval($values[$path]) != $values[$path]
|| (!$allow_neg && $values[$path] < 0)
|| (!$allow_zero && $values[$path] == 0)
|| (! $allow_neg && $values[$path] < 0)
|| (! $allow_zero && $values[$path] == 0)
|| $values[$path] > $max_value
) {
return $error_string;

View File

@ -612,7 +612,7 @@ function PMA_DBI_get_tables_full($database, $table = false,
$each_tables = apc_fetch($cacheKey);
}
if (!$each_tables) {
if (! $each_tables) {
$each_tables = PMA_DBI_fetch_result($sql, 'Name', null, $link);
}
@ -855,7 +855,7 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
* cause MySQL does not support natural ordering, we have to do it afterward
*/
$limit = '';
if (!$GLOBALS['cfg']['NaturalOrder']) {
if (! $GLOBALS['cfg']['NaturalOrder']) {
if ($limit_count) {
$limit = ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
}
@ -1313,7 +1313,7 @@ function PMA_DBI_get_columns($database, $table, $column = null, $full = false,
$has_pk_candidates = true;
}
}
if (!$has_pk && $has_pk_candidates) {
if (! $has_pk && $has_pk_candidates) {
// check whether we can promote some unique index to PRI
$sql = "
SELECT i.index_name, p.column_name

View File

@ -298,7 +298,7 @@ class PMA_DrizzleResult
*/
public function getColumns()
{
if (!$this->_columns) {
if (! $this->_columns) {
$this->_readColumns();
}
return $this->_columns;
@ -324,7 +324,7 @@ class PMA_DrizzleResult
*/
private function _transformResultRow(&$row, $fetchMode)
{
if (!$row) {
if (! $row) {
return;
}
@ -354,7 +354,7 @@ class PMA_DrizzleResult
{
// read column names on first fetch, only buffered results
// allow for reading it later
if (!$this->_columns) {
if (! $this->_columns) {
$this->_readColumns();
}
if ($fetchMode === null) {

View File

@ -108,14 +108,14 @@ function PMA_DBI_connect($user, $password, $is_controluser = false,
$client_flags |= DRIZZLE_CAPABILITIES_SSL;
}
if (!$server) {
if (! $server) {
$link = @PMA_DBI_real_connect(
$drizzle, $cfg['Server']['host'], $server_port, $server_socket, $user,
$password, false, $client_flags
);
// Retry with empty password if we're allowed to
if ($link == false && isset($cfg['Server']['nopassword'])
&& $cfg['Server']['nopassword'] && !$is_controluser
&& $cfg['Server']['nopassword'] && ! $is_controluser
) {
$link = @PMA_DBI_real_connect(
$drizzle, $cfg['Server']['host'], $server_port, $server_socket,

View File

@ -129,14 +129,14 @@ function PMA_DBI_connect(
$client_flags |= MYSQL_CLIENT_SSL;
}
if (!$server) {
if (! $server) {
$link = PMA_DBI_real_connect(
$cfg['Server']['host'] . $server_port . $server_socket,
$user, $password, empty($client_flags) ? null : $client_flags
);
// Retry with empty password if we're allowed to
if (empty($link) && $cfg['Server']['nopassword'] && !$is_controluser) {
if (empty($link) && $cfg['Server']['nopassword'] && ! $is_controluser) {
$link = PMA_DBI_real_connect(
$cfg['Server']['host'] . $server_port . $server_socket,
$user, '', empty($client_flags) ? null : $client_flags

View File

@ -161,7 +161,7 @@ function PMA_DBI_connect(
$client_flags |= MYSQLI_CLIENT_SSL;
}
if (!$server) {
if (! $server) {
$return_value = @PMA_DBI_real_connect(
$link,
$cfg['Server']['host'],
@ -175,7 +175,7 @@ function PMA_DBI_connect(
// Retry with empty password if we're allowed to
if ($return_value == false
&& isset($cfg['Server']['nopassword']) && $cfg['Server']['nopassword']
&& !$is_controluser
&& ! $is_controluser
) {
$return_value = @PMA_DBI_real_connect(
$link,

View File

@ -127,7 +127,7 @@ if (! empty($submit_mult)
case 'change':
PMA_displayHtmlForColumnChange($db, $table, $selected, $action);
// execution stops here but PMA_Response correctly finishes
// the rendering
// the rendering
exit;
case 'browse':
// this should already be handled by tbl_structure.php
@ -165,7 +165,7 @@ if (!empty($submit_mult) && !empty($what)) {
}
$selected_cnt = count($selected);
$i = 0;
foreach ($selected AS $idx => $sval) {
foreach ($selected as $idx => $sval) {
switch ($what) {
case 'row_delete':
$full_query .= 'DELETE FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table)
@ -503,7 +503,7 @@ if (!empty($submit_mult) && !empty($what)) {
PMA_DBI_select_db($db);
}
$result = PMA_DBI_query($a_query);
if ($query_type == 'drop_db') {
PMA_clearTransformations($selected[$i]);
} elseif ($query_type == 'drop_tbl') {
@ -511,7 +511,7 @@ if (!empty($submit_mult) && !empty($what)) {
} else if ($query_type == 'drop_fld') {
PMA_clearTransformations($db, $table, $selected[$i]);
}
} // end if
} // end for

View File

@ -80,7 +80,7 @@ if (! PMA_Util::cacheExists('mysql_charsets', true)) {
}
sort($mysql_collations_flat, SORT_STRING);
foreach ($mysql_collations AS $key => $value) {
foreach ($mysql_collations as $key => $value) {
sort($mysql_collations[$key], SORT_STRING);
reset($mysql_collations[$key]);
}

View File

@ -1361,11 +1361,11 @@ function PMA_getHtmlForReferentialIntegrityCheck($foreign, $url_params)
$html_output .= '<ul>';
foreach ($foreign AS $master => $arr) {
foreach ($foreign as $master => $arr) {
$join_query = 'SELECT '
. PMA_Util::backquote($GLOBALS['table']) . '.*'
. ' FROM ' . PMA_Util::backquote($GLOBALS['table'])
. ' LEFT JOIN '
. ' LEFT JOIN '
. PMA_Util::backquote($arr['foreign_db'])
. '.'
. PMA_Util::backquote($arr['foreign_table']);
@ -1378,13 +1378,13 @@ function PMA_getHtmlForReferentialIntegrityCheck($foreign, $url_params)
$join_query .= ' ON '
. PMA_Util::backquote($GLOBALS['table']) . '.'
. PMA_Util::backquote($master)
. ' = '
. PMA_Util::backquote($arr['foreign_db'])
. ' = '
. PMA_Util::backquote($arr['foreign_db'])
. '.'
. PMA_Util::backquote($foreign_table) . '.'
. PMA_Util::backquote($arr['foreign_field'])
. ' WHERE '
. PMA_Util::backquote($arr['foreign_db'])
. PMA_Util::backquote($arr['foreign_db'])
. '.'
. PMA_Util::backquote($foreign_table) . '.'
. PMA_Util::backquote($arr['foreign_field'])

View File

@ -1350,7 +1350,7 @@ class ExportSql extends ExportPlugin
. PMA_Util::backquote($table, $sql_backquotes) . ':'
);
@reset($mime_map);
foreach ($mime_map AS $mime_field => $mime) {
foreach ($mime_map as $mime_field => $mime) {
$schema_create .=
$this->_exportComment(
' '
@ -1375,7 +1375,7 @@ class ExportSql extends ExportPlugin
. PMA_Util::backquote($table, $sql_backquotes)
. ':'
);
foreach ($res_rel AS $rel_field => $rel) {
foreach ($res_rel as $rel_field => $rel) {
$schema_create .=
$this->_exportComment(
' '

View File

@ -226,11 +226,11 @@ class Table_Stats
function __construct($tableName, $pageNumber, $showKeys = false)
{
global $dia, $cfgRelation, $db;
$this->tableName = $tableName;
$sql = 'DESCRIBE ' . PMA_Util::backquote($tableName);
$result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
if (! $result || ! PMA_DBI_num_rows($result)) {
$dia->dieSchema(
$pageNumber, "DIA",
sprintf(__('The %s table doesn\'t exist!'), $tableName)

View File

@ -837,7 +837,7 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
$alltables = $this->getAllTables($db, $this->pageNumber);
foreach ($alltables AS $table) {
foreach ($alltables as $table) {
if (! isset($this->_tables[$table])) {
$this->_tables[$table] = new Table_Stats(
$table, $eps->getFont(), $eps->getFontSize(), $this->pageNumber,

View File

@ -191,7 +191,7 @@ class PMA_Export_Relation_Schema
public function getAllTables($db, $pageNumber)
{
global $cfgRelation;
// Get All tables
$tab_sql = 'SELECT table_name FROM '
. PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.'
@ -200,7 +200,7 @@ class PMA_Export_Relation_Schema
. ' AND pdf_page_number = ' . $pageNumber;
$tab_rs = PMA_queryAsControlUser($tab_sql, null, PMA_DBI_QUERY_STORE);
if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) {
if (! $tab_rs || ! PMA_DBI_num_rows($tab_rs) > 0) {
$this->dieSchema('', __('This page does not contain any tables!'));
}
while ($curr_table = @PMA_DBI_fetch_assoc($tab_rs)) {

View File

@ -435,7 +435,7 @@ class Table_Stats
. ' AND pdf_page_number = ' . $pageNumber;
$result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
if (! $result || ! PMA_DBI_num_rows($result)) {
$svg->dieSchema(
$pageNumber,
"SVG",
@ -811,7 +811,7 @@ class PMA_Svg_Relation_Schema extends PMA_Export_Relation_Schema
$svg->startSvgDoc('1000px', '1000px');
$alltables = $this->getAllTables($db, $this->pageNumber);
foreach ($alltables AS $table) {
foreach ($alltables as $table) {
if (! isset($this->_tables[$table])) {
$this->_tables[$table] = new Table_Stats(
$table, $svg->getFont(), $svg->getFontSize(), $this->pageNumber,

View File

@ -329,7 +329,7 @@ class PMA_User_Schema
echo 'even';
}
echo '">';
$odd_row = !$odd_row;
$odd_row = ! $odd_row;
echo '<td>';
echo '<select name="c_table_' . $i . '[name]">';
@ -514,7 +514,7 @@ class PMA_User_Schema
$shoot = true;
}
}
if (!$shoot) {
if (! $shoot) {
return;
}
echo '<br /><form action="schema_edit.php" method="post">' . "\n"
@ -569,7 +569,7 @@ class PMA_User_Schema
. 'class="pdflayout_table"'
. '>'
. '<u>'
. htmlspecialchars($temp_sh_page['table_name'])
. htmlspecialchars($temp_sh_page['table_name'])
. '</u>';
if (isset($with_field_names)) {

View File

@ -225,7 +225,7 @@ class Table_Stats
$this->_tableName = $tableName;
$sql = 'DESCRIBE ' . PMA_Util::backquote($tableName);
$result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
if (! $result || ! PMA_DBI_num_rows($result)) {
$visio->dieSchema(
$pageNumber,
"VISIO",
@ -275,7 +275,7 @@ class Table_Stats
. ' AND pdf_page_number = ' . $pageNumber;
$result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
if (! $result || ! PMA_DBI_num_rows($result)) {
$visio->dieSchema(
$pageNumber,
"VISIO",

View File

@ -545,7 +545,7 @@ if (count($columns) > 0) {
. '<select name="display_field">'
. '<option value="">---</option>';
foreach ($save_row AS $row) {
foreach ($save_row as $row) {
$html_output .= '<option value="'
. htmlspecialchars($row['Field']) . '"';
if (isset($disp) && $row['Field'] == $disp) {

View File

@ -300,7 +300,8 @@ if (isset($_REQUEST['snapshot'])) {
$drop_create_statements = $data['ddlog'][0]['statement'];
if (strstr($data['ddlog'][0]['statement'], 'DROP TABLE')
|| strstr($data['ddlog'][0]['statement'], 'DROP VIEW')) {
|| strstr($data['ddlog'][0]['statement'], 'DROP VIEW')
) {
$drop_create_statements .= $data['ddlog'][1]['statement'];
}
// Print SQL code

View File

@ -770,8 +770,8 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase
$this->object->set('fontsize', 10);
$this->assertEquals(10 + $partial_sum, $this->object->getThemeUniqueValue());
$this->object->set('fontsize', NULL);
$this->object->set('fontsize', null);
$_COOKIE['pma_fontsize'] = 20;
$this->assertEquals(20 + $partial_sum, $this->object->getThemeUniqueValue());
unset($_COOKIE['pma_fontsize']);

View File

@ -66,9 +66,6 @@ class PMA_Scripts_test extends PHPUnit_Framework_TestCase
/**
* Test for _includeFile
*
* @param array $files A list of files to include
* @param string $output output from the _includeFile method
*
* @return void
*/
public function testIncludeFile()

View File

@ -107,12 +107,11 @@ class PMA_build_html_for_db_test extends PHPUnit_Framework_TestCase
*
* @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 $output
* @param array $tags
*
* @return void
* @dataProvider providerForTestBuildHtmlForDb

View File

@ -77,7 +77,7 @@ if ($cfgRelation['commwork'] && $cfgRelation['mimework']) {
? $mime_map[$transform_key]['transformation_options'] : ''
);
foreach ($mime_options AS $key => $option) {
foreach ($mime_options as $key => $option) {
if (substr($option, 0, 10) == '; charset=') {
$mime_options['charset'] = $option;
}