Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--import.php6
-rw-r--r--navigation.php14
-rw-r--r--pmd_pdf.php2
-rw-r--r--pmd_relation_upd.php6
-rw-r--r--pmd_save_pos.php10
-rw-r--r--server_binlog.php3
-rw-r--r--server_databases.php54
-rw-r--r--server_privileges.php6
-rw-r--r--server_variables.php13
-rw-r--r--sql.php216
10 files changed, 220 insertions, 110 deletions
diff --git a/import.php b/import.php
index f34fa70c53..4df85995a9 100644
--- a/import.php
+++ b/import.php
@@ -301,7 +301,7 @@ if (! empty($local_import_file) && ! empty($cfg['UploadDir'])) {
$import_file = $common_functions->userDir($cfg['UploadDir'])
. $local_import_file;
-
+
} elseif (empty($import_file) || ! is_uploaded_file($import_file)) {
$import_file = 'none';
}
@@ -530,7 +530,9 @@ if (strlen($sql_query) <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
// There was an error?
if (isset($my_die)) {
foreach ($my_die AS $key => $die) {
- $common_functions->mysqlDie($die['error'], $die['sql'], '', $err_url, $error);
+ $common_functions->mysqlDie(
+ $die['error'], $die['sql'], '', $err_url, $error
+ );
}
}
diff --git a/navigation.php b/navigation.php
index c74184c502..f0725e4919 100644
--- a/navigation.php
+++ b/navigation.php
@@ -85,8 +85,8 @@ $header->disableMenu();
$header->setBodyId('body_leftFrame');
$scripts = $header->getScripts();
$scripts->addFile('navigation.js');
-$scripts->addCode('
- // INIT PMA_setFrameSize
+$scripts->addCode(
+ '// INIT PMA_setFrameSize
var onloadCnt = 0;
var onLoadHandler = window.onload;
var resizeHandler = window.onresize;
@@ -113,8 +113,8 @@ $scripts->addCode('
) {
PMA_saveFrameSize();
}
- };
-');
+ };'
+);
require 'libraries/navigation_header.inc.php';
@@ -339,7 +339,7 @@ function PMA_displayDbList($ext_dblist, $offset, $count)
{
global $element_counter, $img_minus, $img_plus, $href_left,
$db_start, $common_url_query;
-
+
$common_functions = PMA_CommonFunctions::getInstance();
// get table list, for all databases
@@ -530,9 +530,9 @@ function PMA_displayTableList(
$tables, $visible = false,
$tab_group_full = '', $table_db = ''
) {
-
+
$common_functions = PMA_CommonFunctions::getInstance();
-
+
if (! is_array($tables) || count($tables) === 0) {
return;
}
diff --git a/pmd_pdf.php b/pmd_pdf.php
index 69260da7cd..fc9798715b 100644
--- a/pmd_pdf.php
+++ b/pmd_pdf.php
@@ -95,7 +95,7 @@ $header->disableMenu();
<br>
<div>
<?php
- if (!empty($message)) {
+ if (! empty($message)) {
$message->display();
}
?>
diff --git a/pmd_relation_upd.php b/pmd_relation_upd.php
index 3e81ee258b..9e1fd18a6a 100644
--- a/pmd_relation_upd.php
+++ b/pmd_relation_upd.php
@@ -37,9 +37,9 @@ if ($common_functions->isForeignKeySupported($type_T1)
if (isset($existrel_foreign[$F2]['constraint'])) {
$upd_query = 'ALTER TABLE ' . $common_functions->backquote($DB2)
- . '.' . $common_functions->backquote($T2) . ' DROP FOREIGN KEY '
- . $common_functions->backquote($existrel_foreign[$F2]['constraint'])
- . ';';
+ . '.' . $common_functions->backquote($T2) . ' DROP FOREIGN KEY '
+ . $common_functions->backquote($existrel_foreign[$F2]['constraint'])
+ . ';';
$upd_rs = PMA_DBI_query($upd_query);
} else {
// there can be an internal relation even if InnoDB
diff --git a/pmd_save_pos.php b/pmd_save_pos.php
index a009ef146a..92af5ee1dc 100644
--- a/pmd_save_pos.php
+++ b/pmd_save_pos.php
@@ -76,10 +76,10 @@ function PMD_err_sav()
}
if (! empty($die_save_pos)) {
- header("Content-Type: text/xml; charset=utf-8");
- header("Cache-Control: no-cache");
-?>
-<root act='save_pos' return='<?php echo __('Modifications have been saved'); ?>'></root>
-<?php
+ header("Content-Type: text/xml; charset=utf-8");
+ header("Cache-Control: no-cache");
+ ?>
+ <root act='save_pos' return='<?php echo __('Modifications have been saved'); ?>'></root>
+ <?php
}
?>
diff --git a/server_binlog.php b/server_binlog.php
index e3d25dcd07..873c3da3e7 100644
--- a/server_binlog.php
+++ b/server_binlog.php
@@ -137,7 +137,8 @@ if ($pos > 0) {
$this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
}
- echo '<a href="server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
+ echo '<a href="server_binlog.php'
+ . PMA_generate_common_url($this_url_params) . '"';
if ($GLOBALS['cfg']['NavigationBarIconic']) {
echo ' title="' . _pgettext('Previous page', 'Previous') . '">';
} else {
diff --git a/server_databases.php b/server_databases.php
index d31c07ce8a..1cfbee94d0 100644
--- a/server_databases.php
+++ b/server_databases.php
@@ -113,7 +113,13 @@ if ((isset($_REQUEST['drop_selected_dbs']) || isset($_REQUEST['query_type']))
} else {
$number_of_databases = 0;
}
- $message = PMA_Message::success(_ngettext('%1$d database has been dropped successfully.', '%1$d databases have been dropped successfully.', $number_of_databases));
+ $message = PMA_Message::success(
+ _ngettext(
+ '%1$d database has been dropped successfully.',
+ '%1$d databases have been dropped successfully.',
+ $number_of_databases
+ )
+ );
$message->addParam($number_of_databases);
}
}
@@ -207,10 +213,10 @@ if ($databases_count > 0) {
$_url_params['sort_by'] = $stat_name;
$_url_params['sort_order'] = ($sort_by == $stat_name && $sort_order == 'desc') ? 'asc' : 'desc';
echo ' <th' . $colspan . '>'
- .'<a href="server_databases.php' . PMA_generate_common_url($_url_params) . '">' . "\n"
- .' ' . $stat['disp_name'] . "\n"
- .($sort_by == $stat_name ? ' ' . $common_functions->getImage('s_' . $sort_order . '.png', ($sort_order == 'asc' ? __('Ascending') : __('Descending'))) . "\n" : '')
- .' </a></th>' . "\n";
+ . '<a href="server_databases.php' . PMA_generate_common_url($_url_params) . '">' . "\n"
+ . ' ' . $stat['disp_name'] . "\n"
+ . ($sort_by == $stat_name ? ' ' . $common_functions->getImage('s_' . $sort_order . '.png', ($sort_order == 'asc' ? __('Ascending') : __('Descending'))) . "\n" : '')
+ . ' </a></th>' . "\n";
}
}
@@ -242,7 +248,15 @@ if ($databases_count > 0) {
echo '<tr class="' . $tr_class . '">' . "\n";
$odd_row = ! $odd_row;
- list($column_order, $generated_html) = PMA_buildHtmlForDb($current, $is_superuser, (isset($checkall) ? $checkall : ''), $url_query, $column_order, $replication_types, $replication_info);
+ list($column_order, $generated_html) = PMA_buildHtmlForDb(
+ $current,
+ $is_superuser,
+ (isset($checkall) ? $checkall : ''),
+ $url_query,
+ $column_order,
+ $replication_types,
+ $replication_info
+ );
echo $generated_html;
@@ -294,21 +308,35 @@ if ($databases_count > 0) {
unset($column_order, $stat_name, $stat, $databases, $table_columns);
if ($is_superuser || $cfg['AllowUserDropDatabase']) {
- $common_url_query = PMA_generate_common_url(array('sort_by' => $sort_by, 'sort_order' => $sort_order, 'dbstats' => $dbstats));
- echo '<img class="selectallarrow" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" width="38" height="22" alt="' . __('With selected:') . '" />' . "\n"
+ $common_url_query = PMA_generate_common_url(
+ array(
+ 'sort_by' => $sort_by,
+ 'sort_order' => $sort_order,
+ 'dbstats' => $dbstats
+ )
+ );
+ echo '<img class="selectallarrow" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"'
+ . ' width="38" height="22" alt="' . __('With selected:') . '" />' . "\n"
. '<input type="checkbox" id="checkall" title="' . __('Check All') . '" /> '
. '<label for="checkall">' . __('Check All') . '</label> '
. '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
- echo $common_functions->getButtonOrImage('drop_selected_dbs', 'mult_submit' . ($cfg['AjaxEnable'] ? ' ajax' : ''), 'drop_selected_dbs', __('Drop'), 'b_deltbl.png');
+ echo $common_functions->getButtonOrImage(
+ 'drop_selected_dbs',
+ 'mult_submit' . ($cfg['AjaxEnable'] ? ' ajax' : ''),
+ 'drop_selected_dbs',
+ __('Drop'), 'b_deltbl.png'
+ );
}
if (empty($dbstats)) {
echo '<ul><li id="li_switch_dbstats"><strong>' . "\n";
- echo ' <a href="server_databases.php?' . $url_query . '&amp;dbstats=1"'
- .' title="' . __('Enable Statistics') . '">' . "\n"
- .' ' . __('Enable Statistics');
+ echo '<a href="server_databases.php?' . $url_query . '&amp;dbstats=1"'
+ . ' title="' . __('Enable Statistics') . '">' . "\n"
+ . ' ' . __('Enable Statistics');
echo '</a></strong><br />' . "\n";
- PMA_Message::notice(__('Note: Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server.'))->display();
+ PMA_Message::notice(
+ __('Note: Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server.')
+ )->display();
echo '</li>' . "\n" . '</ul>' . "\n";
}
echo '</form>';
diff --git a/server_privileges.php b/server_privileges.php
index 7fa9c48672..106685d1e3 100644
--- a/server_privileges.php
+++ b/server_privileges.php
@@ -146,9 +146,9 @@ if (isset($dbname)) {
if (! $is_superuser) {
$response->addHTML(
'<h2>' . "\n"
- . $common_functions->getIcon('b_usrlist.png')
- . __('Privileges') . "\n"
- . '</h2>' . "\n"
+ . $common_functions->getIcon('b_usrlist.png')
+ . __('Privileges') . "\n"
+ . '</h2>' . "\n"
);
$response->addHTML(PMA_Message::error(__('No Privileges'))->getDisplay());
exit;
diff --git a/server_variables.php b/server_variables.php
index 5617b89f25..7984009f42 100644
--- a/server_variables.php
+++ b/server_variables.php
@@ -40,7 +40,8 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
header('Content-Type: text/html; charset=UTF-8');
$varValue = PMA_DBI_fetch_single_row(
'SHOW GLOBAL VARIABLES WHERE Variable_name="'
- . $common_functions->sqlAddSlashes($_REQUEST['varName']) . '";', 'NUM'
+ . $common_functions->sqlAddSlashes($_REQUEST['varName']) . '";',
+ 'NUM'
);
if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
&& $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte'
@@ -167,12 +168,16 @@ foreach ($serverVars as $name => $value) {
function formatVariable($name, $value)
{
global $VARIABLE_DOC_LINKS;
-
+
$common_functions = PMA_CommonFunctions::getInstance();
if (is_numeric($value)) {
- if (isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte') {
- return '<abbr title="'.$common_functions->formatNumber($value, 0).'">'.implode(' ', $common_functions->formatByteDown($value, 3, 3)).'</abbr>';
+ if (isset($VARIABLE_DOC_LINKS[$name][3])
+ && $VARIABLE_DOC_LINKS[$name][3]=='byte'
+ ) {
+ return '<abbr title="' . $common_functions->formatNumber($value, 0) . '">'
+ . implode(' ', $common_functions->formatByteDown($value, 3, 3))
+ . '</abbr>';
} else {
return $common_functions->formatNumber($value, 0);
}
diff --git a/sql.php b/sql.php
index fedf75fff4..7abf5732c6 100644
--- a/sql.php
+++ b/sql.php
@@ -96,8 +96,8 @@ if (! empty($goto)) {
if (! isset($err_url)) {
$err_url = (! empty($back) ? $back : $goto)
- . '?' . PMA_generate_common_url($db)
- . ((strpos(' ' . $goto, 'db_') != 1 && strlen($table)) ? '&amp;table=' . urlencode($table) : '');
+ . '?' . PMA_generate_common_url($db)
+ . ((strpos(' ' . $goto, 'db_') != 1 && strlen($table)) ? '&amp;table=' . urlencode($table) : '');
} // end if
// Coming from a bookmark dialog
@@ -118,12 +118,16 @@ if (isset($fields['dbase'])) {
* This doesn't seem to be the right place to do this, but I can't think of any
* better place either.
*/
-if (isset($_REQUEST['get_relational_values']) && $_REQUEST['get_relational_values'] == true) {
-
+if (isset($_REQUEST['get_relational_values'])
+ && $_REQUEST['get_relational_values'] == true
+) {
$column = $_REQUEST['column'];
$foreigners = PMA_getForeigners($db, $table, $column);
- $display_field = PMA_getDisplayField($foreigners[$column]['foreign_db'], $foreigners[$column]['foreign_table']);
+ $display_field = PMA_getDisplayField(
+ $foreigners[$column]['foreign_db'],
+ $foreigners[$column]['foreign_table']
+ );
$foreignData = PMA_getForeignData($foreigners, $column, false, '', '');
@@ -138,18 +142,29 @@ if (isset($_REQUEST['get_relational_values']) && $_REQUEST['get_relational_value
$curr_value = $_REQUEST['curr_value'];
}
if ($foreignData['disp_row'] == null) {
- //Handle the case when number of values is more than $cfg['ForeignKeyMaxLimit']
+ //Handle the case when number of values
+ //is more than $cfg['ForeignKeyMaxLimit']
$_url_params = array(
'db' => $db,
'table' => $table,
'field' => $column
);
- $dropdown = '<span class="curr_value">' . htmlspecialchars($_REQUEST['curr_value']) . '</span> <a href="browse_foreigners.php' . PMA_generate_common_url($_url_params) . '"'
- . ' target="_blank" class="browse_foreign" '
- .'>' . __('Browse foreign values') . '</a>';
+ $dropdown = '<span class="curr_value">'
+ . htmlspecialchars($_REQUEST['curr_value'])
+ . '</span>'
+ . '<a href="browse_foreigners.php' . PMA_generate_common_url($_url_params) . '"'
+ . ' target="_blank" class="browse_foreign" ' .'>'
+ . __('Browse foreign values')
+ . '</a>';
} else {
- $dropdown = PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], $curr_value, $cfg['ForeignKeyMaxLimit']);
+ $dropdown = PMA_foreignDropdown(
+ $foreignData['disp_row'],
+ $foreignData['foreign_field'],
+ $foreignData['foreign_display'],
+ $curr_value,
+ $cfg['ForeignKeyMaxLimit']
+ );
$dropdown = '<select>' . $dropdown . '</select>';
}
@@ -166,7 +181,9 @@ if (isset($_REQUEST['get_relational_values']) && $_REQUEST['get_relational_value
if (isset($_REQUEST['get_enum_values']) && $_REQUEST['get_enum_values'] == true) {
$field_info_query = PMA_DBI_get_columns_sql($db, $table, $_REQUEST['column']);
- $field_info_result = PMA_DBI_fetch_result($field_info_query, null, null, null, PMA_DBI_QUERY_STORE);
+ $field_info_result = PMA_DBI_fetch_result(
+ $field_info_query, null, null, null, PMA_DBI_QUERY_STORE
+ );
$values = $common_functions->parseEnumSetValues($field_info_result[0]['Type']);
@@ -192,7 +209,9 @@ if (isset($_REQUEST['get_enum_values']) && $_REQUEST['get_enum_values'] == true)
if (isset($_REQUEST['get_set_values']) && $_REQUEST['get_set_values'] == true) {
$field_info_query = PMA_DBI_get_columns_sql($db, $table, $_REQUEST['column']);
- $field_info_result = PMA_DBI_fetch_result($field_info_query, null, null, null, PMA_DBI_QUERY_STORE);
+ $field_info_result = PMA_DBI_fetch_result(
+ $field_info_query, null, null, null, PMA_DBI_QUERY_STORE
+ );
$selected_values = explode(',', $_REQUEST['curr_value']);
@@ -208,7 +227,8 @@ if (isset($_REQUEST['get_set_values']) && $_REQUEST['get_set_values'] == true) {
}
$select_size = (sizeof($values) > 10) ? 10 : sizeof($values);
- $select = '<select multiple="multiple" size="' . $select_size . '">' . $select . '</select>';
+ $select = '<select multiple="multiple" size="' . $select_size . '">'
+ . $select . '</select>';
$response = PMA_Response::getInstance();
$response->addJSON('select', $select);
@@ -226,9 +246,10 @@ if (isset($_REQUEST['set_col_prefs']) && $_REQUEST['set_col_prefs'] == true) {
if (isset($_REQUEST['col_order'])) {
$col_order = explode(',', $_REQUEST['col_order']);
$retval = $pmatable->setUiProp(
- PMA_Table::PROP_COLUMN_ORDER, $col_order,
+ PMA_Table::PROP_COLUMN_ORDER,
+ $col_order,
$_REQUEST['table_create_time']
- );
+ );
if (gettype($retval) != 'boolean') {
$response = PMA_Response::getInstance();
$response->isSuccess(false);
@@ -243,7 +264,7 @@ if (isset($_REQUEST['set_col_prefs']) && $_REQUEST['set_col_prefs'] == true) {
$retval = $pmatable->setUiProp(
PMA_Table::PROP_COLUMN_VISIB, $col_visib,
$_REQUEST['table_create_time']
- );
+ );
if (gettype($retval) != 'boolean') {
$response = PMA_Response::getInstance();
$response->isSuccess(false);
@@ -271,10 +292,8 @@ if (empty($sql_query) && strlen($table) && strlen($db)) {
if (! empty($book_sql_query)) {
$GLOBALS['using_bookmark_message'] = PMA_message::notice(
- __(
- 'Using bookmark "%s" as default browse query.'
- )
- );
+ __('Using bookmark "%s" as default browse query.')
+ );
$GLOBALS['using_bookmark_message']->addParam($table);
$GLOBALS['using_bookmark_message']->addMessage(
$common_functions->showDocu('faq6_22')
@@ -340,11 +359,9 @@ if (isset($find_real_end) && $find_real_end) {
*/
if (isset($store_bkm)) {
PMA_Bookmark_save(
- $fields, (isset($bkm_all_users)
- && $bkm_all_users == 'true'
- ? true
- : false)
- );
+ $fields,
+ (isset($bkm_all_users) && $bkm_all_users == 'true' ? true : false)
+ );
// go back to sql.php to redisplay query; do not use &amp; in this case:
PMA_sendHeaderLocation(
$cfg['PmaAbsoluteUri'] . $goto . '&label=' . $fields['label']
@@ -414,9 +431,9 @@ if (! $cfg['Confirm']
if ($do_confirm) {
$stripped_sql_query = $sql_query;
if ($is_drop_database) {
- echo '<h1 class="error">' . __(
- 'You are about to DESTROY a complete database!'
- ) . '</h1>';
+ echo '<h1 class="error">'
+ . __('You are about to DESTROY a complete database!')
+ . '</h1>';
}
echo '<form action="sql.php" method="post">' . "\n"
.PMA_generate_common_hidden_inputs($db, $table);
@@ -500,8 +517,11 @@ if (($_SESSION['tmp_user_values']['max_rows'] != 'all')
&& ! isset($analyzed_sql[0]['queryflags']['offset'])
&& empty($analyzed_sql[0]['limit_clause'])
) {
-
- $full_sql_query = PMA_getSqlWithLimitClause($full_sql_query, $analyzed_sql, $sql_limit_to_append);
+ $full_sql_query = PMA_getSqlWithLimitClause(
+ $full_sql_query,
+ $analyzed_sql,
+ $sql_limit_to_append
+ );
/**
* @todo pretty printing of this modified query
@@ -516,7 +536,8 @@ if (($_SESSION['tmp_user_values']['max_rows'] != 'all')
) {
$analyzed_display_query = PMA_SQP_analyze(PMA_SQP_parse($display_query));
$display_query = $analyzed_display_query[0]['section_before_limit']
- . "\n" . $sql_limit_to_append . $analyzed_display_query[0]['section_after_limit'];
+ . "\n" . $sql_limit_to_append
+ . $analyzed_display_query[0]['section_after_limit'];
}
}
@@ -583,9 +604,9 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) {
*/
include '' . PMA_securePath($goto);
} else {
- $full_err_url = (preg_match('@^(db|tbl)_@', $err_url))
- ? $err_url . '&amp;show_query=1&amp;sql_query=' . urlencode($sql_query)
- : $err_url;
+ $full_err_url = preg_match('@^(db|tbl)_@', $err_url)
+ ? $err_url . '&amp;show_query=1&amp;sql_query=' . urlencode($sql_query)
+ : $err_url;
$common_functions->mysqlDie($error, $full_sql_query, '', $full_err_url);
}
exit;
@@ -696,10 +717,19 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) {
// take the left part, could be:
// SELECT
// (SELECT
- $count_query = PMA_SQP_formatHtml($parsed_sql, 'query_only', 0, $analyzed_sql[0]['position_of_first_select'] + 1);
+ $count_query = PMA_SQP_formatHtml(
+ $parsed_sql,
+ 'query_only',
+ 0,
+ $analyzed_sql[0]['position_of_first_select'] + 1
+ );
$count_query .= ' SQL_CALC_FOUND_ROWS ';
// add everything that was after the first SELECT
- $count_query .= PMA_SQP_formatHtml($parsed_sql, 'query_only', $analyzed_sql[0]['position_of_first_select'] + 1);
+ $count_query .= PMA_SQP_formatHtml(
+ $parsed_sql,
+ 'query_only',
+ $analyzed_sql[0]['position_of_first_select'] + 1
+ );
// ensure there is no semicolon at the end of the
// count query because we'll probably add
// a LIMIT 1 clause after it
@@ -756,7 +786,11 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) {
} // end if ($purge)
// If a column gets dropped, do relation magic.
- if (isset($dropped_column) && strlen($db) && strlen($table) && ! empty($dropped_column)) {
+ if (isset($dropped_column)
+ && strlen($db)
+ && strlen($table)
+ && ! empty($dropped_column)
+ ) {
include_once 'libraries/relation_cleanup.lib.php';
PMA_relationsCleanupColumn($db, $table, $dropped_column);
// to refresh the list of indexes (Ajax mode)
@@ -798,14 +832,16 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
$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 */
+ // For replace we get DELETED + INSERTED row count,
+ // so we have to call it affected
$message = PMA_Message::getMessageForAffectedRows($num_rows);
} else {
$message = PMA_Message::getMessageForInsertedRows($num_rows);
}
$insert_id = PMA_DBI_insert_id();
if ($insert_id != 0) {
- // insert_id is id of FIRST record inserted in one insert, so if we inserted multiple rows, we had to increment this
+ // insert_id is id of FIRST record inserted in one insert,
+ // so if we inserted multiple rows, we had to increment this
$message->addMessage('[br]');
// need to use a temporary because the Message class
// currently supports adding parameters only to the first
@@ -890,10 +926,12 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
if (0 == $num_rows && 'sql.php' == $cfg['DefaultTabTable']) {
$goto = str_replace('sql.php', 'tbl_structure.php', $goto);
}
- PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . str_replace('&amp;', '&', $goto) . '&message=' . urlencode($message));
+ PMA_sendHeaderLocation(
+ $cfg['PmaAbsoluteUri'] . str_replace('&amp;', '&', $goto) . '&message=' . urlencode($message)
+ );
} // end else
exit();
-// end no rows returned
+ // end no rows returned
} else {
// At least one row is returned -> displays a table with results
//If we are retrieving the full value of a truncated field or the original
@@ -947,7 +985,8 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
echo getTableHtmlForMultipleQueries(
$displayResultsObject, $db, $sql_data, $goto,
- $pmaThemeImage, $text_dir, $printview, $url_query, $disp_mode, $sql_limit_to_append
+ $pmaThemeImage, $text_dir, $printview, $url_query,
+ $disp_mode, $sql_limit_to_append
);
} else {
@@ -956,8 +995,9 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
$displayResultsObject->setProperties(
$unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func,
- $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir,
- $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query
+ $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage,
+ $text_dir, $is_maint, $is_explain, $is_show, $showtable,
+ $printview, $url_query
);
echo $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql);
@@ -1116,13 +1156,14 @@ $(makeProfilingChart);
$printview = isset($printview) ? $printview : null;
$url_query = isset($url_query) ? $url_query : null;
- if (!empty($sql_data) && ($sql_data['valid_queries'] > 1) || $is_procedure) {
+ if (! empty($sql_data) && ($sql_data['valid_queries'] > 1) || $is_procedure) {
$_SESSION['is_multi_query'] = true;
echo getTableHtmlForMultipleQueries(
$displayResultsObject, $db, $sql_data, $goto,
- $pmaThemeImage, $text_dir, $printview, $url_query, $disp_mode, $sql_limit_to_append
+ $pmaThemeImage, $text_dir, $printview, $url_query,
+ $disp_mode, $sql_limit_to_append
);
} else {
@@ -1131,8 +1172,9 @@ $(makeProfilingChart);
$displayResultsObject->setProperties(
$unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func,
- $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir,
- $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query
+ $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage,
+ $text_dir, $is_maint, $is_explain, $is_show, $showtable,
+ $printview, $url_query
);
echo $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql);
@@ -1140,7 +1182,11 @@ $(makeProfilingChart);
}
// BEGIN INDEX CHECK See if indexes should be checked.
- if (isset($query_type) && $query_type == 'check_tbl' && isset($selected) && is_array($selected)) {
+ if (isset($query_type)
+ && $query_type == 'check_tbl'
+ && isset($selected)
+ && is_array($selected)
+ ) {
foreach ($selected as $idx => $tbl_name) {
$check = PMA_Index::findDuplicates($tbl_name, $db);
if (! empty($check)) {
@@ -1235,8 +1281,8 @@ function PMA_getDisplayPropertyParams($sql_query, $is_select)
$is_group = preg_match('@(GROUP[[:space:]]+BY|HAVING|SELECT[[:space:]]+DISTINCT)[[:space:]]+@i', $sql_query);
$is_func = ! $is_group && (preg_match('@[[:space:]]+(SUM|AVG|STD|STDDEV|MIN|MAX|BIT_OR|BIT_AND)\s*\(@i', $sql_query));
$is_count = ! $is_group && (preg_match('@^SELECT[[:space:]]+COUNT\((.*\.+)?.*\)@i', $sql_query));
- $is_export = (preg_match('@[[:space:]]+INTO[[:space:]]+OUTFILE[[:space:]]+@i', $sql_query));
- $is_analyse = (preg_match('@[[:space:]]+PROCEDURE[[:space:]]+ANALYSE@i', $sql_query));
+ $is_export = preg_match('@[[:space:]]+INTO[[:space:]]+OUTFILE[[:space:]]+@i', $sql_query);
+ $is_analyse = preg_match('@[[:space:]]+PROCEDURE[[:space:]]+ANALYSE@i', $sql_query);
} elseif (preg_match('@^EXPLAIN[[:space:]]+@i', $sql_query)) {
$is_explain = true;
} elseif (preg_match('@^DELETE[[:space:]]+@i', $sql_query)) {
@@ -1323,9 +1369,9 @@ function PMA_getTableNameBySQL($sql, $tables)
* @param PMA_DisplayResults $displayResultsObject object
* @param string $db database name
* @param array $sql_data information about SQL statement
- * @param string $goto the URL to go back in case of errors
+ * @param string $goto URL to go back in case of errors
* @param string $pmaThemeImage path for theme images directory
- * @param string $text_dir
+ * @param string $text_dir text direction
* @param string $printview
* @param string $url_query URL query
* @param array $disp_mode the display mode
@@ -1358,7 +1404,9 @@ function getTableHtmlForMultipleQueries(
$is_affected = false;
$result = PMA_DBI_store_result();
- $fields_meta = ($result !== false) ? PMA_DBI_get_fields_meta($result) : array();
+ $fields_meta = ($result !== false)
+ ? PMA_DBI_get_fields_meta($result)
+ : array();
$fields_cnt = count($fields_meta);
// Initialize needed params related to each query in multiquery statement
@@ -1366,14 +1414,22 @@ function getTableHtmlForMultipleQueries(
// 'Use' query can change the database
if (stripos($sql_data['valid_sql'][$sql_no], "use ")) {
- $db = PMA_getNewDatabase($sql_data['valid_sql'][$sql_no], $databases_array);
+ $db = PMA_getNewDatabase(
+ $sql_data['valid_sql'][$sql_no],
+ $databases_array
+ );
}
$parsed_sql = PMA_SQP_parse($sql_data['valid_sql'][$sql_no]);
- $table = PMA_getTableNameBySQL($sql_data['valid_sql'][$sql_no], $tables_array);
+ $table = PMA_getTableNameBySQL(
+ $sql_data['valid_sql'][$sql_no],
+ $tables_array
+ );
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
$is_select = isset($analyzed_sql[0]['queryflags']['select_from']);
- $unlim_num_rows = PMA_Table::countRecords($db, $table, $force_exact = true);
+ $unlim_num_rows = PMA_Table::countRecords(
+ $db, $table, $force_exact = true
+ );
$showtable = PMA_Table::sGetStatusInfo($db, $table, null, true);
$url_query = PMA_generate_common_url($db, $table);
@@ -1392,7 +1448,12 @@ function getTableHtmlForMultipleQueries(
&& isset($analyzed_sql[0]['queryflags']['select_from'])
&& count($analyzed_sql[0]['table_ref']) == 1
) {
- PMA_handleSortOrder($db, $table, $analyzed_sql, $sql_data['valid_sql'][$sql_no]);
+ PMA_handleSortOrder(
+ $db,
+ $table,
+ $analyzed_sql,
+ $sql_data['valid_sql'][$sql_no]
+ );
}
// Do append a "LIMIT" clause?
@@ -1403,7 +1464,9 @@ function getTableHtmlForMultipleQueries(
&& empty($analyzed_sql[0]['limit_clause'])
) {
$sql_data['valid_sql'][$sql_no] = PMA_getSqlWithLimitClause(
- $sql_data['valid_sql'][$sql_no], $analyzed_sql, $sql_limit_to_append
+ $sql_data['valid_sql'][$sql_no],
+ $analyzed_sql,
+ $sql_limit_to_append
);
}
@@ -1422,11 +1485,15 @@ function getTableHtmlForMultipleQueries(
if (isset($sql_data['valid_sql'][$sql_no])) {
- $displayResultsObject->__set('_sql_query', $sql_data['valid_sql'][$sql_no]);
+ $displayResultsObject->__set(
+ '_sql_query',
+ $sql_data['valid_sql'][$sql_no]
+ );
$displayResultsObject->setProperties(
$unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func,
- $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir,
- $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query
+ $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage,
+ $text_dir, $is_maint, $is_explain, $is_show, $showtable,
+ $printview, $url_query
);
}
@@ -1458,10 +1525,12 @@ function getTableHtmlForMultipleQueries(
/**
* Handle remembered sorting order, only for single table query
*
- * @param string $db database name
- * @param string $table table name
- * @param array $analyzed_sql the analyzed query
- * @param string $full_sql_query SQL query
+ * @param string $db database name
+ * @param string $table table name
+ * @param array &$analyzed_sql the analyzed query
+ * @param string &$full_sql_query SQL query
+ *
+ * @return void
*/
function PMA_handleSortOrder($db, $table, &$analyzed_sql, &$full_sql_query)
{
@@ -1472,8 +1541,9 @@ function PMA_handleSortOrder($db, $table, &$analyzed_sql, &$full_sql_query)
if ($sorted_col) {
// retrieve the remembered sorting order for current table
$sql_order_to_append = ' ORDER BY ' . $sorted_col . ' ';
- $full_sql_query = $analyzed_sql[0]['section_before_limit'] . $sql_order_to_append
- . $analyzed_sql[0]['limit_clause'] . ' ' . $analyzed_sql[0]['section_after_limit'];
+ $full_sql_query = $analyzed_sql[0]['section_before_limit']
+ . $sql_order_to_append . $analyzed_sql[0]['limit_clause']
+ . ' ' . $analyzed_sql[0]['section_after_limit'];
// update the $analyzed_sql
$analyzed_sql[0]['section_before_limit'] .= $sql_order_to_append;
@@ -1481,7 +1551,10 @@ function PMA_handleSortOrder($db, $table, &$analyzed_sql, &$full_sql_query)
}
} else {
// store the remembered table into session
- $pmatable->setUiProp(PMA_Table::PROP_SORTED_COLUMN, $analyzed_sql[0]['order_by_clause']);
+ $pmatable->setUiProp(
+ PMA_Table::PROP_SORTED_COLUMN,
+ $analyzed_sql[0]['order_by_clause']
+ );
}
}
@@ -1495,8 +1568,9 @@ function PMA_handleSortOrder($db, $table, &$analyzed_sql, &$full_sql_query)
*
* @return string limit clause appended SQL query
*/
-function PMA_getSqlWithLimitClause($full_sql_query, $analyzed_sql, $sql_limit_to_append)
-{
+function PMA_getSqlWithLimitClause($full_sql_query, $analyzed_sql,
+ $sql_limit_to_append
+) {
return $analyzed_sql[0]['section_before_limit'] . "\n"
. $sql_limit_to_append . $analyzed_sql[0]['section_after_limit'];
}