Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2012-08-30 19:55:38 +02:00
commit 68d9e03cca
21 changed files with 246 additions and 236 deletions

View File

@ -983,22 +983,23 @@ class PMA_CommonFunctions
*
* </code>
*
* @param mixed $a_name the database, table or field name to "backquote"
* or array of it
* @param mixed $a_name the database, table or field name to
* "backquote" or array of it
* @param string $compatibility string compatibility mode (used by dump
* functions)
* @param boolean $do_it a flag to bypass this function (used by dump
* functions)
* @return mixed the "backquoted" database, table or field name
* functions)
* @param boolean $do_it a flag to bypass this function (used by dump
* functions)
*
* @return mixed the "backquoted" database, table or field name
*
* @access public
*/
public function backquote_compat($a_name, $compatibility = 'MSSQL', $do_it = true)
public function backquoteCompat($a_name, $compatibility = 'MSSQL', $do_it = true)
{
if (is_array($a_name)) {
foreach ($a_name as &$data) {
$data = $this->backquote_compat($data, $compatibility, $do_it);
$data = $this->backquoteCompat($data, $compatibility, $do_it);
}
return $a_name;
}
@ -1013,8 +1014,12 @@ class PMA_CommonFunctions
// @todo add more compatibility cases (ORACLE for example)
switch ($compatibility) {
case 'MSSQL': $quote = '"'; break;
default: (isset($GLOBALS['sql_backquotes'])) ? $quote = "`" : $quote = ''; break;
case 'MSSQL':
$quote = '"';
break;
default:
(isset($GLOBALS['sql_backquotes'])) ? $quote = "`" : $quote = '';
break;
}
// '0' is also empty for php :-(
@ -1024,7 +1029,7 @@ class PMA_CommonFunctions
return $a_name;
}
} // end of the 'backquote_compat()' function
} // end of the 'backquoteCompat()' function
/**
* Defines the <CR><LF> value depending on the user OS.

View File

@ -85,7 +85,7 @@ class PMA_Message
* @access protected
* @var integer
*/
protected $_number = PMA_Message::NOTICE;
protected $number = PMA_Message::NOTICE;
/**
* The locale string identifier
@ -93,7 +93,7 @@ class PMA_Message
* @access protected
* @var string
*/
protected $_string = '';
protected $string = '';
/**
* The formatted message
@ -101,7 +101,7 @@ class PMA_Message
* @access protected
* @var string
*/
protected $_message = '';
protected $message = '';
/**
* Whether the message was already displayed
@ -109,7 +109,7 @@ class PMA_Message
* @access protected
* @var boolean
*/
protected $_is_displayed = false;
protected $isDisplayed = false;
/**
* Unique id
@ -125,7 +125,7 @@ class PMA_Message
* @access protected
* @var array
*/
protected $_params = array();
protected $params = array();
/**
* holds additional messages
@ -133,7 +133,7 @@ class PMA_Message
* @access protected
* @var array
*/
protected $_added_messages = array();
protected $addedMessages = array();
/**
* Constructor
@ -248,7 +248,7 @@ class PMA_Message
* @return PMA_Message
* @static
*/
static public function affected_rows($rows)
static public function getMessageForAffectedRows($rows)
{
$message = PMA_Message::success(
_ngettext('%1$d row affected.', '%1$d rows affected.', $rows)
@ -267,7 +267,7 @@ class PMA_Message
* @return PMA_Message
* @static
*/
static public function deleted_rows($rows)
static public function getMessageForDeletedRows($rows)
{
$message = PMA_Message::success(
_ngettext('%1$d row deleted.', '%1$d rows deleted.', $rows)
@ -286,7 +286,7 @@ class PMA_Message
* @return PMA_Message
* @static
*/
static public function inserted_rows($rows)
static public function getMessageForInsertedRows($rows)
{
$message = PMA_Message::success(
_ngettext('%1$d row inserted.', '%1$d rows inserted.', $rows)
@ -404,24 +404,24 @@ class PMA_Message
if ($sanitize) {
$message = PMA_Message::sanitize($message);
}
$this->_message = $message;
$this->message = $message;
}
/**
* set string (does not take effect if raw message is set)
*
* @param string $_string
* @param string $string
*
* @param boolean $sanitize whether to sanitize $string or not
*
* @return void
*/
public function setString($_string, $sanitize = true)
public function setString($string, $sanitize = true)
{
if ($sanitize) {
$_string = PMA_Message::sanitize($_string);
$string = PMA_Message::sanitize($string);
}
$this->_string = $_string;
$this->string = $string;
}
/**
@ -433,7 +433,7 @@ class PMA_Message
*/
public function setNumber($number)
{
$this->_number = $number;
$this->number = $number;
}
/**
@ -454,11 +454,11 @@ class PMA_Message
public function addParam($param, $raw = true)
{
if ($param instanceof PMA_Message) {
$this->_params[] = $param;
$this->params[] = $param;
} elseif ($raw) {
$this->_params[] = htmlspecialchars($param);
$this->params[] = htmlspecialchars($param);
} else {
$this->_params[] = PMA_Message::notice($param);
$this->params[] = PMA_Message::notice($param);
}
}
@ -472,8 +472,8 @@ class PMA_Message
*/
public function addString($string, $separator = ' ')
{
$this->_added_messages[] = $separator;
$this->_added_messages[] = PMA_Message::notice($string);
$this->addedMessages[] = $separator;
$this->addedMessages[] = PMA_Message::notice($string);
}
/**
@ -502,13 +502,13 @@ class PMA_Message
public function addMessage($message, $separator = ' ')
{
if (strlen($separator)) {
$this->_added_messages[] = $separator;
$this->addedMessages[] = $separator;
}
if ($message instanceof PMA_Message) {
$this->_added_messages[] = $message;
$this->addedMessages[] = $message;
} else {
$this->_added_messages[] = PMA_Message::rawNotice($message);
$this->addedMessages[] = PMA_Message::rawNotice($message);
}
}
@ -525,7 +525,7 @@ class PMA_Message
if ($sanitize) {
$params = PMA_Message::sanitize($params);
}
$this->_params = $params;
$this->params = $params;
}
/**
@ -535,7 +535,7 @@ class PMA_Message
*/
public function getParams()
{
return $this->_params;
return $this->params;
}
/**
@ -545,7 +545,7 @@ class PMA_Message
*/
public function getAddedMessages()
{
return $this->_added_messages;
return $this->addedMessages;
}
/**
@ -611,8 +611,8 @@ class PMA_Message
if (null === $this->hash) {
$this->hash = md5(
$this->getNumber() .
$this->_string .
$this->_message
$this->string .
$this->message
);
}
@ -626,7 +626,7 @@ class PMA_Message
*/
public function getMessage()
{
$message = $this->_message;
$message = $this->message;
if (0 === strlen($message)) {
$string = $this->getString();
@ -653,23 +653,23 @@ class PMA_Message
}
/**
* returns PMA_Message::$_string
* returns PMA_Message::$string
*
* @return string PMA_Message::$_string
* @return string PMA_Message::$string
*/
public function getString()
{
return $this->_string;
return $this->string;
}
/**
* returns PMA_Message::$_number
* returns PMA_Message::$number
*
* @return integer PMA_Message::$_number
* @return integer PMA_Message::$number
*/
public function getNumber()
{
return $this->_number;
return $this->number;
}
/**
@ -710,15 +710,15 @@ class PMA_Message
*
* @param boolean $is_displayed
*
* @return boolean PMA_Message::$_is_displayed
* @return boolean PMA_Message::$isDisplayed
*/
public function isDisplayed($is_displayed = false)
public function isDisplayed($isDisplayed = false)
{
if ($is_displayed) {
$this->_is_displayed = true;
if ($isDisplayed) {
$this->isDisplayed = true;
}
return $this->_is_displayed;
return $this->isDisplayed;
}
}
?>

View File

@ -599,8 +599,9 @@ function PMA_DBI_field_flags($result, $i)
// so we have to check also the type.
// Unfortunately there is no equivalent in the mysql extension.
if (($type == DRIZZLE_COLUMN_TYPE_DRIZZLE_BLOB
|| $type == DRIZZLE_COLUMN_TYPE_DRIZZLE_VARCHAR)
&& 63 == $charsetnr) {
|| $type == DRIZZLE_COLUMN_TYPE_DRIZZLE_VARCHAR)
&& 63 == $charsetnr
) {
$flags .= 'binary ';
}
if ($f & DRIZZLE_COLUMN_FLAGS_ZEROFILL) {

View File

@ -179,7 +179,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false, &$sql_d
$msg .= __('Rows'). ': ' . $a_num_rows;
$last_query_with_results = $import_run_buffer['sql'];
} elseif ($a_aff_rows > 0) {
$message = PMA_Message::affected_rows($a_aff_rows);
$message = PMA_Message::getMessageForAffectedRows($a_aff_rows);
$msg .= $message->getMessage();
} else {
$msg .= __('MySQL returned an empty result set (i.e. zero rows).');

View File

@ -702,7 +702,7 @@ class ExportSql extends ExportPlugin
if (! PMA_exportOutputHandler(
'DROP DATABASE '
. (isset($GLOBALS['sql_backquotes'])
? $common_functions->backquote_compat($db, $compat) : $db)
? $common_functions->backquoteCompat($db, $compat) : $db)
. ';' . $crlf
)) {
return false;
@ -710,7 +710,7 @@ class ExportSql extends ExportPlugin
}
$create_query = 'CREATE DATABASE '
. (isset($GLOBALS['sql_backquotes'])
? $common_functions->backquote_compat($db, $compat) : $db);
? $common_functions->backquoteCompat($db, $compat) : $db);
$collation = PMA_getDbCollation($db);
if (PMA_DRIZZLE) {
$create_query .= ' COLLATE ' . $collation;
@ -733,7 +733,7 @@ class ExportSql extends ExportPlugin
|| PMA_DRIZZLE)
) {
$result = PMA_exportOutputHandler(
'USE ' . $common_functions->backquote_compat($db, $compat)
'USE ' . $common_functions->backquoteCompat($db, $compat)
. ';' . $crlf
);
} else {
@ -761,7 +761,7 @@ class ExportSql extends ExportPlugin
. $this->_exportComment(
__('Database') . ': '
. (isset($GLOBALS['sql_backquotes'])
? PMA_CommonFunctions::getInstance()->backquote_compat($db, $compat)
? PMA_CommonFunctions::getInstance()->backquoteCompat($db, $compat)
: '\'' . $db . '\'')
)
. $this->_exportComment();
@ -1213,21 +1213,21 @@ class ExportSql extends ExportPlugin
. $this->_exportComment(
__('Constraints for table')
. ' '
. $common_functions->backquote_compat($table, $compat)
. $common_functions->backquoteCompat($table, $compat)
)
. $this->_exportComment();
}
// let's do the work
$sql_constraints_query .= 'ALTER TABLE '
. $common_functions->backquote_compat($table, $compat)
. $common_functions->backquoteCompat($table, $compat)
. $crlf;
$sql_constraints .= 'ALTER TABLE '
. $common_functions->backquote_compat($table, $compat)
. $common_functions->backquoteCompat($table, $compat)
. $crlf;
$sql_drop_foreign_keys .= 'ALTER TABLE '
. $common_functions->backquote_compat($db, $compat) . '.'
. $common_functions->backquote_compat($table, $compat)
. $common_functions->backquoteCompat($db, $compat) . '.'
. $common_functions->backquoteCompat($table, $compat)
. $crlf;
$first = true;
@ -1451,7 +1451,7 @@ class ExportSql extends ExportPlugin
}
$formatted_table_name = (isset($GLOBALS['sql_backquotes']))
? $common_functions->backquote_compat($table, $compat)
? $common_functions->backquoteCompat($table, $compat)
: '\'' . $table . '\'';
$dump = $this->_possibleCRLF()
. $this->_exportComment(str_repeat('-', 56))
@ -1543,7 +1543,7 @@ class ExportSql extends ExportPlugin
$common_functions = PMA_CommonFunctions::getInstance();
$formatted_table_name = (isset($GLOBALS['sql_backquotes']))
? $common_functions->backquote_compat($table, $compat)
? $common_functions->backquoteCompat($table, $compat)
: '\'' . $table . '\'';
// Do not export data for a VIEW
@ -1590,13 +1590,13 @@ class ExportSql extends ExportPlugin
for ($j = 0; $j < $fields_cnt; $j++) {
if (isset($analyzed_sql[0]['select_expr'][$j]['column'])) {
$field_set[$j] = $common_functions->backquote_compat(
$field_set[$j] = $common_functions->backquoteCompat(
$analyzed_sql[0]['select_expr'][$j]['column'],
$compat,
$sql_backquotes
);
} else {
$field_set[$j] = $common_functions->backquote_compat(
$field_set[$j] = $common_functions->backquoteCompat(
$fields_meta[$j]->name,
$compat,
$sql_backquotes
@ -1613,7 +1613,7 @@ class ExportSql extends ExportPlugin
$schema_insert .= 'IGNORE ';
}
// avoid EOL blank
$schema_insert .= $common_functions->backquote_compat(
$schema_insert .= $common_functions->backquoteCompat(
$table,
$compat,
$sql_backquotes
@ -1648,7 +1648,7 @@ class ExportSql extends ExportPlugin
&& $sql_command == 'INSERT'
) {
$truncate = 'TRUNCATE TABLE '
. $common_functions->backquote_compat(
. $common_functions->backquoteCompat(
$table,
$compat,
$sql_backquotes
@ -1673,7 +1673,7 @@ class ExportSql extends ExportPlugin
) {
$fields = implode(', ', $field_set);
$schema_insert = $sql_command . $insert_delayed .' INTO '
. $common_functions->backquote_compat(
. $common_functions->backquoteCompat(
$table,
$compat,
$sql_backquotes
@ -1682,7 +1682,7 @@ class ExportSql extends ExportPlugin
. ' (' . $fields . ') VALUES';
} else {
$schema_insert = $sql_command . $insert_delayed .' INTO '
. $common_functions->backquote_compat(
. $common_functions->backquoteCompat(
$table,
$compat,
$sql_backquotes
@ -1728,7 +1728,7 @@ class ExportSql extends ExportPlugin
) {
if (! PMA_exportOutputHandler(
'SET IDENTITY_INSERT '
. $common_functions->backquote_compat(
. $common_functions->backquoteCompat(
$table,
$compat
)
@ -1865,21 +1865,19 @@ class ExportSql extends ExportPlugin
}
// We need to SET IDENTITY_INSERT OFF for MSSQL
if (isset($GLOBALS['sql_compatibility'])
&& $GLOBALS['sql_compatibility'] == 'MSSQL'
&& $current_row > 0
)
if (! PMA_exportOutputHandler(
$crlf . 'SET IDENTITY_INSERT '
. $common_functions->backquote_compat(
$table,
$compat
)
. ' OFF;' . $crlf
)) {
return false;
if (isset($GLOBALS['sql_compatibility'])
&& $GLOBALS['sql_compatibility'] == 'MSSQL'
&& $current_row > 0
) {
$outputSucceeded = PMA_exportOutputHandler(
$crlf . 'SET IDENTITY_INSERT '
. $common_functions->backquoteCompat($table, $compat)
. ' OFF;' . $crlf
);
if (! $outputSucceeded) {
return false;
}
}
} // end if ($result != false)
PMA_DBI_free_result($result);

View File

@ -852,9 +852,9 @@ function PMA_SQP_typeCheck($toCheck, $whatWeWant)
*/
function PMA_SQP_analyze($arr)
{
$common_functions = PMA_CommonFunctions::getInstance();
if ($arr == array() || ! isset($arr['len'])) {
return array();
}
@ -1911,14 +1911,13 @@ function PMA_SQP_analyze($arr)
}
if (isset($clause)
&& ($arr[$i+2]['type'] == 'alpha_reservedWord'
// ugly workaround because currently, NO is not
// in the list of reserved words in sqlparser.data
// (we got a bug report about not being able to use
// 'no' as an identifier)
|| ($arr[$i+2]['type'] == 'alpha_identifier'
&& strtoupper($arr[$i+2]['data'])=='NO'))
) {
// ugly workaround because currently, NO is not
// in the list of reserved words in sqlparser.data
// (we got a bug report about not being able to use
// 'no' as an identifier)
|| ($arr[$i+2]['type'] == 'alpha_identifier'
&& strtoupper($arr[$i+2]['data'])=='NO'))
) {
$third_upper_data = strtoupper($arr[$i+2]['data']);
if ($third_upper_data == 'CASCADE'
|| $third_upper_data == 'RESTRICT'
@ -2149,9 +2148,9 @@ function PMA_SQP_formatHtml(
$number_of_tokens=-1
) {
global $PMA_SQPdata_operators_docs, $PMA_SQPdata_functions_docs;
$common_functions = PMA_CommonFunctions::getInstance();
//DEBUG echo 'in Format<pre>'; print_r($arr); echo '</pre>';
// then check for an array
if (! is_array($arr)) {
@ -2291,7 +2290,7 @@ function PMA_SQP_formatHtml(
&& isset($keywords_with_brackets_2before[strtoupper($arr[$i - 2]['data'])]))
|| (($typearr[1] == 'alpha_reservedWord')
&& isset($keywords_with_brackets_1before[strtoupper($arr[$i - 1]['data'])]))
) {
) {
$functionlevel++;
$infunction = true;
$after .= ' ';

View File

@ -897,7 +897,7 @@ foreach ($sections as $section_id => $section_name) {
</fieldset>
<div id="linkSuggestions" class="defaultLinks" style="display:none">
<p class="notice"><?php echo __('Related links:'); ?>
<?php
foreach ($links as $section_name => $section_links) {
echo '<span class="status_' . $section_name . '"> ';
@ -1067,7 +1067,7 @@ function printServerTraffic()
{
global $server_status, $PMA_PHP_SELF;
global $server_master_status, $server_slave_status, $replication_types;
$common_functions = PMA_CommonFunctions::getInstance();
$hour_factor = 3600 / $server_status['Uptime'];
@ -1271,7 +1271,7 @@ function printServerTraffic()
} else {
$full_text_link = 'server_status.php' . PMA_generate_common_url(array('full' => 1));
}
// This array contains display name and real column name of each
// sortable column in the table
$sortable_columns = array(
@ -1309,7 +1309,7 @@ function printServerTraffic()
)
);
$sortable_columns_count = count($sortable_columns);
if (PMA_DRIZZLE) {
$sql_query = "SELECT
p.id AS Id,
@ -1338,7 +1338,7 @@ function printServerTraffic()
. $_REQUEST['order_by_field'] . '` ' . $_REQUEST['sort_order'];
}
}
$result = PMA_DBI_query($sql_query);
/**
@ -1349,18 +1349,18 @@ function printServerTraffic()
<thead>
<tr>
<th><?php echo __('Processes'); ?></th>
<?php foreach ($sortable_columns as $column): ?>
<?php foreach ($sortable_columns as $column) { ?>
<?php
$is_sorted = !empty($_REQUEST['order_by_field'])
&& !empty($_REQUEST['sort_order'])
&& ($_REQUEST['order_by_field'] == $column['order_by_field']);
$column['sort_order'] = ($is_sorted
&& ($_REQUEST['sort_order'] == 'ASC'))
? 'DESC'
: 'ASC';
if ($is_sorted) {
if ($_REQUEST['sort_order'] == 'ASC') {
$asc_display_style = 'inline';
@ -1374,38 +1374,38 @@ function printServerTraffic()
<th>
<a href="server_status.php<?php echo PMA_generate_common_url($column) ?>"
<?php if ($is_sorted): ?>
<?php if ($is_sorted) { ?>
onmouseout="$('.soimg').toggle()" onmouseover="$('.soimg').toggle()"
<?php endif; ?>
<?php } ?>
>
<?php echo $column['column_name']; ?>
<?php if ($is_sorted): ?>
<?php if ($is_sorted) { ?>
<img class="icon ic_s_desc soimg" alt="Descending" title="" src="themes/dot.gif" style="display: <?php echo $desc_display_style; ?>;" />
<img class="icon ic_s_asc soimg hide" alt="Ascending" title="" src="themes/dot.gif" style="display: <?php echo $asc_display_style; ?>;" />
<?php endif; ?>
<?php } ?>
</a>
<?php if (! PMA_DRIZZLE && (0 === --$sortable_columns_count)): ?>
<?php if (! PMA_DRIZZLE && (0 === --$sortable_columns_count)) { ?>
<a href="<?php echo $full_text_link; ?>"
title="<?php echo $show_full_sql ? __('Truncate Shown Queries') : __('Show Full Queries'); ?>">
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . ($show_full_sql ? 'partial' : 'full'); ?>text.png"
alt="<?php echo $show_full_sql ? __('Truncate Shown Queries') : __('Show Full Queries'); ?>" />
</a>
<?php endif; ?>
<?php } ?>
</th>
<?php endforeach; ?>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
$odd_row = true;
while ($process = PMA_DBI_fetch_assoc($result)) {
// Array keys need to modify due to the way it has used
// to display column values
if (!empty($_REQUEST['order_by_field'])
@ -1417,7 +1417,7 @@ function printServerTraffic()
unset($process[$key]);
}
}
$url_params['kill'] = $process['Id'];
$kill_process = 'server_status.php' . PMA_generate_common_url($url_params);
?>
@ -1456,9 +1456,9 @@ function printServerTraffic()
function printVariablesTable()
{
global $server_status, $server_variables, $allocationMap, $links;
$common_functions = PMA_CommonFunctions::getInstance();
/**
* Messages are built using the message name
*/
@ -1724,9 +1724,9 @@ function printVariablesTable()
function printMonitor()
{
global $server_status, $server_db_isLocal;
$common_functions = PMA_CommonFunctions::getInstance();
?>
<div class="tabLinks" style="display:none;">
<a href="#pauseCharts">

View File

@ -795,13 +795,13 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
}
if ($is_delete) {
$message = PMA_Message::deleted_rows($num_rows);
$message = PMA_Message::getMessageForDeletedRows($num_rows);
} elseif ($is_insert) {
if ($is_replace) {
/* For replace we get DELETED + INSERTED row count, so we have to call it affected */
$message = PMA_Message::affected_rows($num_rows);
$message = PMA_Message::getMessageForAffectedRows($num_rows);
} else {
$message = PMA_Message::inserted_rows($num_rows);
$message = PMA_Message::getMessageForInsertedRows($num_rows);
}
$insert_id = PMA_DBI_insert_id();
if ($insert_id != 0) {
@ -815,7 +815,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
$message->addMessage($_inserted);
}
} elseif ($is_affected) {
$message = PMA_Message::affected_rows($num_rows);
$message = PMA_Message::getMessageForAffectedRows($num_rows);
// Ok, here is an explanation for the !$is_select.
// The form generated by sql_query_form.lib.php

View File

@ -41,7 +41,8 @@ $err_url = 'tbl_structure.php?' . PMA_generate_common_url($db, $table);
*/
if (isset($_REQUEST['move_columns'])
&& is_array($_REQUEST['move_columns'])
&& $GLOBALS['is_ajax_request']) {
&& $GLOBALS['is_ajax_request']
) {
/*
* first, load the definitions for all columns
*/

View File

@ -252,10 +252,8 @@ foreach ($index->getColumns() as $column) {
<option value="">-- <?php echo __('Ignore'); ?> --</option>
<?php
foreach ($fields as $field_name => $field_type) {
if (($index->getType() != 'FULLTEXT'
|| preg_match('/(char|text)/i', $field_type))
&& ($index->getType() != 'SPATIAL'
|| in_array($field_type, $spatial_types))
if (($index->getType() != 'FULLTEXT' || preg_match('/(char|text)/i', $field_type))
&& ($index->getType() != 'SPATIAL' || in_array($field_type, $spatial_types))
) {
echo '<option value="' . htmlspecialchars($field_name) . '"'
. (($field_name == $column->getName())

View File

@ -65,7 +65,7 @@ if ($is_aria) {
// ($transactional may have been set by libraries/tbl_info.inc.php,
// from the $create_options)
$transactional = (isset($transactional) && $transactional == '0')
? '0'
? '0'
: '1';
$page_checksum = (isset($page_checksum)) ? $page_checksum : '';
}
@ -106,7 +106,7 @@ if (isset($_REQUEST['submitoptions'])) {
$result = false;
}
}
if (! empty($_REQUEST['new_tbl_storage_engine'])
&& strtolower($_REQUEST['new_tbl_storage_engine'])
!== strtolower($tbl_storage_engine)
@ -119,12 +119,12 @@ if (isset($_REQUEST['submitoptions'])) {
if ($is_aria) {
$transactional = (isset($transactional) && $transactional == '0')
? '0'
? '0'
: '1';
$page_checksum = (isset($page_checksum)) ? $page_checksum : '';
}
}
$table_alters = PMA_getTableAltersArray(
$is_myisam_or_aria, $is_isam, $pack_keys,
(empty($checksum) ? '0' : '1'),
@ -138,7 +138,7 @@ if (isset($_REQUEST['submitoptions'])) {
);
if (count($table_alters) > 0) {
$sql_query = 'ALTER TABLE '
$sql_query = 'ALTER TABLE '
. $common_functions->backquote($GLOBALS['table']);
$sql_query .= "\r\n" . implode("\r\n", $table_alters);
$sql_query .= ';';
@ -158,7 +158,7 @@ if (isset($_REQUEST['submitorderby']) && ! empty($_REQUEST['order_field'])) {
/**
* A partition operation has been requested by the user
*/
if (isset($_REQUEST['submit_partition'])
if (isset($_REQUEST['submit_partition'])
&& ! empty($_REQUEST['partition_operation'])
) {
list($sql_query, $result) = PMA_getQueryAndResultForPartition();
@ -178,14 +178,14 @@ if (isset($result) && empty($message_to_show)) {
// (for example, a table rename)
$_type = 'success';
if (empty($_message)) {
$_message = $result
$_message = $result
? PMA_Message::success(
__('Your SQL query has been executed successfully')
)
: PMA_Message::error(__('Error'));
// $result should exist, regardless of $_message
$_type = $result ? 'success' : 'error';
if (isset($GLOBALS['ajax_request'])
&& $GLOBALS['ajax_request'] == true
) {
@ -266,7 +266,7 @@ $response->addHTML(
$is_myisam_or_aria, $is_isam, $pack_keys,
$auto_increment,
(empty($delay_key_write) ? '0' : '1'),
((isset($transactional) && $transactional == '0') ? '0' : '1'),
((isset($transactional) && $transactional == '0') ? '0' : '1'),
((isset($page_checksum)) ? $page_checksum : ''),
$is_innodb, $is_pbxt, $is_aria, (empty($checksum) ? '0' : '1')
)
@ -283,19 +283,22 @@ $response->addHTML('<br class="clearfloat"/>');
* Table maintenance
*/
$response->addHTML(
PMA_getHtmlForTableMaintenance($is_myisam_or_aria, $is_innodb,
$is_berkeleydb, $url_params
PMA_getHtmlForTableMaintenance(
$is_myisam_or_aria,
$is_innodb,
$is_berkeleydb,
$url_params
)
);
if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
$truncate_table_url_params = array();
$drop_table_url_params = array();
if (! $tbl_is_view
if (! $tbl_is_view
&& ! (isset($db_is_information_schema) && $db_is_information_schema)
) {
$this_sql_query = 'TRUNCATE TABLE '
$this_sql_query = 'TRUNCATE TABLE '
. $common_functions->backquote($GLOBALS['table']);
$truncate_table_url_params = array_merge(
$url_params,
@ -311,7 +314,7 @@ if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
);
}
if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
$this_sql_query = 'DROP TABLE '
$this_sql_query = 'DROP TABLE '
. $common_functions->backquote($GLOBALS['table']);
$drop_table_url_params = array_merge(
$url_params,
@ -321,8 +324,8 @@ if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
'reload' => '1',
'purge' => '1',
'message_to_show' => sprintf(
($tbl_is_view
? __('View %s has been dropped')
($tbl_is_view
? __('View %s has been dropped')
: __('Table %s has been dropped')
),
htmlspecialchars($table)

View File

@ -243,7 +243,8 @@ foreach ($the_tables as $key => $table) {
if ($cfg['ShowStats']) {
$nonisam = false;
if (isset($showtable['Type'])
&& !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
&& ! preg_match('@ISAM|HEAP@i', $showtable['Type'])
) {
$nonisam = true;
}
if ($nonisam == false) {
@ -251,35 +252,37 @@ foreach ($the_tables as $key => $table) {
$mergetable = PMA_Table::isMerge($db, $table);
list($data_size, $data_unit)
= $common_functions->formatByteDown($showtable['Data_length']);
list($data_size, $data_unit) = $common_functions->formatByteDown(
$showtable['Data_length']
);
if ($mergetable == false) {
list($index_size, $index_unit)
= $common_functions->formatByteDown($showtable['Index_length']);
list($index_size, $index_unit) = $common_functions->formatByteDown(
$showtable['Index_length']
);
}
if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
list($free_size, $free_unit)
= $common_functions->formatByteDown($showtable['Data_free']);
list($effect_size, $effect_unit)
= $common_functions->formatByteDown(
$showtable['Data_length']
+ $showtable['Index_length']
- $showtable['Data_free']);
list($free_size, $free_unit) = $common_functions->formatByteDown(
$showtable['Data_free']
);
list($effect_size, $effect_unit) = $common_functions->formatByteDown(
$showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']
);
} else {
unset($free_size);
unset($free_unit);
list($effect_size, $effect_unit)
= $common_functions->formatByteDown($showtable['Data_length']
+ $showtable['Index_length']);
list($effect_size, $effect_unit) = $common_functions->formatByteDown(
$showtable['Data_length'] + $showtable['Index_length']
);
}
list($tot_size, $tot_unit)
= $common_functions->formatByteDown($showtable['Data_length']
+ $showtable['Index_length']);
list($tot_size, $tot_unit) = $common_functions->formatByteDown(
$showtable['Data_length'] + $showtable['Index_length']
);
if ($num_rows > 0) {
list($avg_size, $avg_unit)
= $common_functions->formatByteDown(($showtable['Data_length']
+ $showtable['Index_length'])
/ $showtable['Rows'], 6, 1);
list($avg_size, $avg_unit) = $common_functions->formatByteDown(
($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'],
6,
1
);
}
// Displays them

View File

@ -258,9 +258,9 @@ list ($url_params, $total_affected_rows, $last_messages, $warning_messages,
= PMA_executeSqlQuery($url_params, $query);
if ($is_insert && count($value_sets) > 0) {
$message = PMA_Message::inserted_rows($total_affected_rows);
$message = PMA_Message::getMessageForInsertedRows($total_affected_rows);
} else {
$message = PMA_Message::affected_rows($total_affected_rows);
$message = PMA_Message::getMessageForAffectedRows($total_affected_rows);
}
$message->addMessages($last_messages, '<br />');
@ -366,7 +366,7 @@ if ($response->isAjax()) {
$extra_data['row_count'] = PMA_Table::countRecords(
$_REQUEST['db'], $_REQUEST['table']
);
$extra_data['sql_query']
= $common_functions->getMessage($message, $GLOBALS['display_query']);

View File

@ -3,6 +3,7 @@
/**
* Displays table structure infos like fields/columns, indexes, size, rows
* and allows manipulation of indexes and columns/fields
*
* @package PhpMyAdmin
*/
@ -71,7 +72,7 @@ if (! empty($submit_mult) && isset($_REQUEST['selected_fld'])) {
// what is this htmlspecialchars() for??
//$sql_query .= ' FROM ' . backquote(htmlspecialchars($table));
$sql_query .= ' FROM ' . $common_functions->backquote($db)
. '.' . $common_functions->backquote($table);
. '.' . $common_functions->backquote($table);
include 'sql.php';
exit;
} else {
@ -141,8 +142,8 @@ $fields = (array) PMA_DBI_get_columns($db, $table, null, true);
// in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910).
$show_create_table = PMA_DBI_fetch_value(
'SHOW CREATE TABLE ' . $common_functions->backquote($db) . '.'
. $common_functions->backquote($table),
'SHOW CREATE TABLE ' . $common_functions->backquote($db) . '.'
. $common_functions->backquote($table),
0, 1
);
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
@ -164,8 +165,8 @@ $hidden_titles = PMA_getHiddenTitlesArray();
$i = 0;
$html_form = '<form method="post" action="tbl_structure.php" name="fieldsForm" '
. 'id="fieldsForm" '
. ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '') . '>';
. 'id="fieldsForm" '
. ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '') . '>';
$response->addHTML($html_form);
$response->addHTML(PMA_generate_common_hidden_inputs($db, $table));
@ -188,7 +189,8 @@ $tablestructure .= '">';
$response->addHTML($tablestructure);
$response->addHTML(PMA_getHtmlForTableStructureHeader(
$response->addHTML(
PMA_getHtmlForTableStructureHeader(
$db_is_information_schema,
$tbl_is_view
)
@ -255,7 +257,7 @@ foreach ($fields as $row) {
&& isset($mime_map[$row['Field']]['mimetype'])
) {
$type_mime = '<br />MIME: '
. str_replace('_', '/', $mime_map[$row['Field']]['mimetype']);
. str_replace('_', '/', $mime_map[$row['Field']]['mimetype']);
} else {
$type_mime = '';
}
@ -264,9 +266,7 @@ foreach ($fields as $row) {
// MySQL 4.1.2+ TIMESTAMP options
// (if on_update_current_timestamp is set, then it's TRUE)
if (isset(
$analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])
) {
if (isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) {
$attribute = 'on update CURRENT_TIMESTAMP';
}
@ -297,56 +297,57 @@ foreach ($fields as $row) {
if (isset($comments_map[$row['Field']])) {
$displayed_field_name = '<span class="commented_column" title="'
. htmlspecialchars($comments_map[$row['Field']]) . '">'
. $field_name . '</span>';
. htmlspecialchars($comments_map[$row['Field']]) . '">'
. $field_name . '</span>';
}
if ($primary && $primary->hasColumn($field_name)) {
$displayed_field_name = '<u>' . $field_name . '</u>';
}
$response->addHTML( "\n");
$response->addHTML("\n");
$response->addHTML(
'<tr class="' . ($odd_row ? 'odd': 'even') . '">'
);
$odd_row = !$odd_row;
$response->addHTML(
PMA_getHtmlTableStructureRow($row, $rownum, $checked,
$displayed_field_name, $type_nowrap, $extracted_columnspec,
$type_mime, $field_charset, $attribute, $tbl_is_view,
PMA_getHtmlTableStructureRow(
$row, $rownum, $checked, $displayed_field_name,
$type_nowrap, $extracted_columnspec, $type_mime,
$field_charset, $attribute, $tbl_is_view,
$db_is_information_schema, $url_query, $field_encoded, $titles, $table
)
);
if (! $tbl_is_view && ! $db_is_information_schema) {
$response->addHTML(
PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine,
$primary, $field_name, $url_query, $titles, $row, $rownum,
PMA_getHtmlForActionsInTableStructure(
$type, $tbl_storage_engine, $primary,
$field_name, $url_query, $titles, $row, $rownum,
$hidden_titles, $columns_with_unique_index
)
);
} // end if (! $tbl_is_view && ! $db_is_information_schema)
$response->addHTML('</tr>');
unset($field_charset);
} // end foreach
$response->addHTML(
'</tbody>' . "\n"
.'</table>' . "\n"
'</tbody>' . "\n" .'</table>' . "\n"
);
$response->addHTML(
PMA_getHtmlForCheckAllTableColumn($pmaThemeImage, $text_dir,
$tbl_is_view, $db_is_information_schema, $tbl_storage_engine
PMA_getHtmlForCheckAllTableColumn(
$pmaThemeImage, $text_dir, $tbl_is_view,
$db_is_information_schema, $tbl_storage_engine
)
);
$response->addHTML(
'</form>'
. '<hr />'
'</form><hr />'
);
$response->addHTML(
PMA_getHtmlDivForMoveColumnsDialog()
@ -360,21 +361,21 @@ if ($tbl_is_view) {
$response->addHTML(PMA_getHtmlForEditView($url_params));
}
$response->addHTML(
PMA_getHtmlForOptionalActionLinks($url_query, $tbl_is_view,
$db_is_information_schema, $tbl_storage_engine, $cfgRelation
PMA_getHtmlForOptionalActionLinks(
$url_query, $tbl_is_view, $db_is_information_schema,
$tbl_storage_engine, $cfgRelation
)
);
if (! $tbl_is_view && ! $db_is_information_schema) {
$response->addHTML('<br />');
$response->addHTML(PMA_getHtmlForAddColumn($columns_list));
$response->addHTML(
'<iframe class="IE_hack"></iframe>'
. '<hr />'
'<iframe class="IE_hack"></iframe><hr />'
);
$response->addHTML(
'<div id="index_div" '
'<div id="index_div" '
. ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '') . ' >'
);
}
@ -397,8 +398,9 @@ if (! $tbl_is_view
// Get valid statistics whatever is the table type
if ($cfg['ShowStats']) {
$response->addHTML(
PMA_getHtmlForDisplayTableStats($showtable, $table_info_num_rows,
$tbl_is_view, $db_is_information_schema, $tbl_storage_engine,
PMA_getHtmlForDisplayTableStats(
$showtable, $table_info_num_rows, $tbl_is_view,
$db_is_information_schema, $tbl_storage_engine,
$url_query, $tbl_collation
)
);
@ -408,5 +410,5 @@ if ($cfg['ShowStats']) {
$response->addHTML(
'<div class="clearfloat"></div>' . "\n"
);
?>

View File

@ -485,7 +485,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase
}
/**
* affected_rows test
* Test for getMessageForAffectedRows() method
*
* @param int $rows Number of rows
* @param string $output Expected string
@ -495,7 +495,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase
public function testAffectedRows($rows, $output)
{
$this->object = new PMA_Message();
$msg = $this->object->affected_rows($rows);
$msg = $this->object->getMessageForAffectedRows($rows);
echo $this->object->addMessage($msg);
$this->expectOutputString($output);
$this->object->display();
@ -511,7 +511,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase
}
/**
* inserted_rows test
* Test for getMessageForInsertedRows() method
*
* @param int $rows Number of rows
* @param string $output Expected string
@ -521,7 +521,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase
public function testInsertedRows($rows, $output)
{
$this->object = new PMA_Message();
$msg = $this->object->inserted_rows($rows);
$msg = $this->object->getMessageForInsertedRows($rows);
echo $this->object->addMessage($msg);
$this->expectOutputString($output);
$this->object->display();
@ -537,7 +537,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase
}
/**
* deleted_rows test
* Test for getMessageForDeletedRows() method
*
* @param int $rows Number of rows
* @param string $output Expected string
@ -547,7 +547,7 @@ class PMA_Message_test extends PHPUnit_Framework_TestCase
public function testDeletedRows($rows, $output)
{
$this->object = new PMA_Message();
$msg = $this->object->deleted_rows($rows);
$msg = $this->object->getMessageForDeletedRows($rows);
echo $this->object->addMessage($msg);
$this->expectOutputString($output);
$this->object->display();

View File

@ -255,7 +255,7 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest
'scale' => 2,
'height' => 150
),
imagecreatetruecolor('120','150'),
imagecreatetruecolor('120', '150'),
''
)
@ -347,7 +347,7 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest
public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output)
{
$this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output);
$this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data), $output);
}
public function providerForPrepareRowAsOl(){

View File

@ -199,7 +199,7 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest
'scale' => 2,
'height' => 150
),
imagecreatetruecolor('120','150'),
imagecreatetruecolor('120', '150'),
''
)
@ -291,7 +291,7 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest
public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output)
{
$this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output);
$this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data), $output);
}
public function providerForPrepareRowAsOl(){

View File

@ -293,7 +293,7 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest
'scale' => 2,
'height' => 150
),
imagecreatetruecolor('120','150'),
imagecreatetruecolor('120', '150'),
''
)
@ -385,7 +385,7 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest
public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output)
{
$this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output);
$this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data), $output);
}
public function providerForPrepareRowAsOl(){

View File

@ -201,7 +201,7 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest
'scale' => 2,
'height' => 150
),
imagecreatetruecolor('120','150'),
imagecreatetruecolor('120', '150'),
''
)
@ -292,7 +292,7 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest
public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output)
{
$this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output);
$this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data), $output);
}
public function providerForPrepareRowAsOl(){

View File

@ -381,7 +381,7 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest
'scale' => 2,
'height' => 150
),
imagecreatetruecolor('120','150'),
imagecreatetruecolor('120', '150'),
''
)
@ -473,7 +473,7 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest
public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output)
{
$this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output);
$this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data), $output);
}
public function providerForPrepareRowAsOl(){

View File

@ -115,11 +115,11 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
}
/**
* data provider for backquote_compat test
* data provider for backquoteCompat test
*
* @return array
*/
public function backquote_compatDataProvider()
public function backquoteCompatDataProvider()
{
return array(
array('0', '"0"'),
@ -130,23 +130,23 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
}
/**
* backquote_compat test with different param $compatibility (NONE, MSSQL)
* @dataProvider backquote_compatDataProvider
* backquoteCompat test with different param $compatibility (NONE, MSSQL)
* @dataProvider backquoteCompatDataProvider
*/
public function testBackquote_compat($a, $b)
public function testbackquoteCompat($a, $b)
{
// Test bypass quoting (used by dump functions)
$this->assertEquals($a, PMA_CommonFunctions::getInstance()->backquote_compat($a, 'NONE', false));
$this->assertEquals($a, PMA_CommonFunctions::getInstance()->backquoteCompat($a, 'NONE', false));
// Test backquote (backquoting will be enabled only if isset $GLOBALS['sql_backquotes']
$this->assertEquals($a, PMA_CommonFunctions::getInstance()->backquote_compat($a, 'NONE'));
$this->assertEquals($a, PMA_CommonFunctions::getInstance()->backquoteCompat($a, 'NONE'));
// Run tests in MSSQL compatibility mode
// Test bypass quoting (used by dump functions)
$this->assertEquals($a, PMA_CommonFunctions::getInstance()->backquote_compat($a, 'MSSQL', false));
$this->assertEquals($a, PMA_CommonFunctions::getInstance()->backquoteCompat($a, 'MSSQL', false));
// Test backquote
$this->assertEquals($b, PMA_CommonFunctions::getInstance()->backquote_compat($a, 'MSSQL'));
$this->assertEquals($b, PMA_CommonFunctions::getInstance()->backquoteCompat($a, 'MSSQL'));
}
public function testBackquoteForbidenWords()