coding standard: no spaces inside braces

This commit is contained in:
Sebastian Mendel
2007-04-01 11:02:46 +00:00
parent adb39168cc
commit cfeb306526
84 changed files with 745 additions and 747 deletions

View File

@@ -56,7 +56,7 @@ $showall = '';
if (isset($disp_row) && is_array($disp_row)) { if (isset($disp_row) && is_array($disp_row)) {
if ( $cfg['ShowAll'] && ($the_total > $per_page) ) { if ($cfg['ShowAll'] && ($the_total > $per_page)) {
$showall = '<input type="submit" name="foreign_navig" value="' . $strShowAll . '" />'; $showall = '<input type="submit" name="foreign_navig" value="' . $strShowAll . '" />';
} }
@@ -64,7 +64,7 @@ if (isset($disp_row) && is_array($disp_row)) {
$pageNow = @floor($pos / $session_max_rows) + 1; $pageNow = @floor($pos / $session_max_rows) + 1;
$nbTotalPage = @ceil($the_total / $session_max_rows); $nbTotalPage = @ceil($the_total / $session_max_rows);
if ( $the_total > $per_page ) { if ($the_total > $per_page) {
$gotopage = PMA_pageselector( $gotopage = PMA_pageselector(
'browse_foreigners.php?field=' . urlencode($field) . 'browse_foreigners.php?field=' . urlencode($field) .
'&amp;' . PMA_generate_common_url($db, $table) '&amp;' . PMA_generate_common_url($db, $table)
@@ -90,22 +90,22 @@ if (isset($disp_row) && is_array($disp_row)) {
<title>phpMyAdmin</title> <title>phpMyAdmin</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="phpmyadmin.css.php?<?php echo PMA_generate_common_url( '', '' ); ?>&amp;js_frame=right&amp;nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" /> href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=right&amp;nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
<script src="./js/functions.js" type="text/javascript" language="javascript"></script> <script src="./js/functions.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
//<![CDATA[ //<![CDATA[
self.focus(); self.focus();
function formupdate( field, key ) { function formupdate(field, key) {
if (opener && opener.document && opener.document.insertForm) { if (opener && opener.document && opener.document.insertForm) {
var field = 'field_' + field; var field = 'field_' + field;
<?php if ( isset( $pk ) ) { ?> <?php if (isset($pk)) { ?>
var element_name = field + '[multi_edit][<?php echo urlencode( $pk ); ?>][]'; var element_name = field + '[multi_edit][<?php echo urlencode($pk); ?>][]';
<?php } else { ?> <?php } else { ?>
var element_name = field + '[]'; var element_name = field + '[]';
<?php } ?> <?php } ?>
<?php if ( isset( $fieldkey ) ) { ?> <?php if (isset($fieldkey)) { ?>
var element_name_alt = field + '[<?php echo $fieldkey; ?>]'; var element_name_alt = field + '[<?php echo $fieldkey; ?>]';
<?php } else { ?> <?php } else { ?>
var element_name_alt = field + '[0]'; var element_name_alt = field + '[0]';
@@ -134,11 +134,11 @@ if (isset($disp_row) && is_array($disp_row)) {
<form action="browse_foreigners.php" method="post"> <form action="browse_foreigners.php" method="post">
<fieldset> <fieldset>
<?php echo PMA_generate_common_hidden_inputs( $db, $table ); ?> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="field" value="<?php echo urlencode($field); ?>" /> <input type="hidden" name="field" value="<?php echo urlencode($field); ?>" />
<input type="hidden" name="fieldkey" <input type="hidden" name="fieldkey"
value="<?php echo isset($fieldkey) ? $fieldkey : ''; ?>" /> value="<?php echo isset($fieldkey) ? $fieldkey : ''; ?>" />
<?php if ( isset( $pk ) ) { ?> <?php if (isset($pk)) { ?>
<input type="hidden" name="pk" value="<?php echo urlencode($pk); ?>" /> <input type="hidden" name="pk" value="<?php echo urlencode($pk); ?>" />
<?php } ?> <?php } ?>
<span class="formelement"> <span class="formelement">
@@ -173,7 +173,7 @@ if (isset($disp_row) && is_array($disp_row)) {
$values = array(); $values = array();
$keys = array(); $keys = array();
foreach ( $disp_row as $relrow ) { foreach ($disp_row as $relrow) {
if ($foreign_display != FALSE) { if ($foreign_display != FALSE) {
$values[] = $relrow[$foreign_display]; $values[] = $relrow[$foreign_display];
} else { } else {
@@ -183,15 +183,15 @@ if (isset($disp_row) && is_array($disp_row)) {
$keys[] = $relrow[$foreign_field]; $keys[] = $relrow[$foreign_field];
} }
asort( $keys ); asort($keys);
$hcount = 0; $hcount = 0;
$odd_row = true; $odd_row = true;
$val_ordered_current_row = 0; $val_ordered_current_row = 0;
$val_ordered_current_equals_data = false; $val_ordered_current_equals_data = false;
$key_ordered_current_equals_data = false; $key_ordered_current_equals_data = false;
foreach ( $keys as $key_ordered_current_row => $value ) { foreach ($keys as $key_ordered_current_row => $value) {
//for ( $i = 0; $i < $count; $i++ ) { //for ($i = 0; $i < $count; $i++) {
$hcount++; $hcount++;
if ($cfg['RepeatCells'] > 0 && $hcount > $cfg['RepeatCells']) { if ($cfg['RepeatCells'] > 0 && $hcount > $cfg['RepeatCells']) {
@@ -208,28 +208,28 @@ if (isset($disp_row) && is_array($disp_row)) {
$val_ordered_current_row++; $val_ordered_current_row++;
if (PMA_strlen( $val_ordered_current_val ) <= $cfg['LimitChars']) { if (PMA_strlen($val_ordered_current_val) <= $cfg['LimitChars']) {
$val_ordered_current_val = htmlspecialchars($val_ordered_current_val); $val_ordered_current_val = htmlspecialchars($val_ordered_current_val);
$val_ordered_current_val_title = ''; $val_ordered_current_val_title = '';
} else { } else {
$val_ordered_current_val_title = $val_ordered_current_val_title =
htmlspecialchars( $val_ordered_current_val ); htmlspecialchars($val_ordered_current_val);
$val_ordered_current_val = $val_ordered_current_val =
htmlspecialchars( PMA_substr( $val_ordered_current_val, 0, htmlspecialchars(PMA_substr($val_ordered_current_val, 0,
$cfg['LimitChars'] ) . '...' ); $cfg['LimitChars']) . '...');
} }
if (PMA_strlen( $key_ordered_current_val ) <= $cfg['LimitChars']) { if (PMA_strlen($key_ordered_current_val) <= $cfg['LimitChars']) {
$key_ordered_current_val = htmlspecialchars($key_ordered_current_val); $key_ordered_current_val = htmlspecialchars($key_ordered_current_val);
$key_ordered_current_val_title = ''; $key_ordered_current_val_title = '';
} else { } else {
$key_ordered_current_val_title = $key_ordered_current_val_title =
htmlspecialchars( $key_ordered_current_val ); htmlspecialchars($key_ordered_current_val);
$key_ordered_current_val = $key_ordered_current_val =
htmlspecialchars( PMA_substr( $key_ordered_current_val, 0, htmlspecialchars(PMA_substr($key_ordered_current_val, 0,
$cfg['LimitChars'] ) . '...' ); $cfg['LimitChars']) . '...');
} }
if ( ! empty( $data ) ) { if (! empty($data)) {
$val_ordered_current_equals_data = $val_ordered_current_key == $data; $val_ordered_current_equals_data = $val_ordered_current_key == $data;
$key_ordered_current_equals_data = $key_ordered_current_key == $data; $key_ordered_current_equals_data = $key_ordered_current_key == $data;
} }

View File

@@ -46,7 +46,7 @@ if ($cfgRelation['commwork']) {
if (is_array($comment)) { if (is_array($comment)) {
?> ?>
<p> <?php echo $strDBComment; ?> <p> <?php echo $strDBComment; ?>
<i><?php echo htmlspecialchars( implode( ' ', $comment ) ); ?></i></p> <i><?php echo htmlspecialchars(implode(' ', $comment)); ?></i></p>
<?php <?php
} // end if } // end if
} }
@@ -77,10 +77,10 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) {
* Gets table informations * Gets table informations
*/ */
// The 'show table' statement works correct since 3.23.03 // The 'show table' statement works correct since 3.23.03
$showtable = PMA_DBI_get_tables_full( $db, $table ); $showtable = PMA_DBI_get_tables_full($db, $table);
$num_rows = (isset($showtable[$table]['TABLE_ROWS']) ? $showtable[$table]['TABLE_ROWS'] : 0); $num_rows = (isset($showtable[$table]['TABLE_ROWS']) ? $showtable[$table]['TABLE_ROWS'] : 0);
$show_comment = (isset($showtable[$table]['TABLE_COMMENT']) ? $showtable[$table]['TABLE_COMMENT'] : ''); $show_comment = (isset($showtable[$table]['TABLE_COMMENT']) ? $showtable[$table]['TABLE_COMMENT'] : '');
unset( $showtable ); unset($showtable);
/** /**
@@ -103,7 +103,7 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) {
$pk_array[$row['Column_name']] = 1; $pk_array[$row['Column_name']] = 1;
} }
// Retains keys informations // Retains keys informations
if ($row['Key_name'] != $lastIndex ){ if ($row['Key_name'] != $lastIndex){
$indexes[] = $row['Key_name']; $indexes[] = $row['Key_name'];
$lastIndex = $row['Key_name']; $lastIndex = $row['Key_name'];
} }
@@ -294,7 +294,7 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) {
</tr> </tr>
<?php <?php
} // end while } // end while
PMA_DBI_free_result( $result ); PMA_DBI_free_result($result);
$count++; $count++;
?> ?>
</table> </table>

View File

@@ -26,7 +26,7 @@ require_once './libraries/db_info.inc.php';
$export_page_title = $strViewDumpDB; $export_page_title = $strViewDumpDB;
// exit if no tables in db found // exit if no tables in db found
if ( $num_tables < 1 ) { if ($num_tables < 1) {
echo $strDatabaseNoTable; echo $strDatabaseNoTable;
require './libraries/footer.inc.php'; require './libraries/footer.inc.php';
exit; exit;
@@ -35,20 +35,20 @@ if ( $num_tables < 1 ) {
$multi_values = '<div align="center"><select name="table_select[]" size="6" multiple="multiple">'; $multi_values = '<div align="center"><select name="table_select[]" size="6" multiple="multiple">';
$multi_values .= "\n"; $multi_values .= "\n";
foreach ( $tables as $each_table ) { foreach ($tables as $each_table) {
// ok we show also views // ok we show also views
//if ( PMA_MYSQL_INT_VERSION >= 50000 && is_null($each_table['Engine']) ) { //if (PMA_MYSQL_INT_VERSION >= 50000 && is_null($each_table['Engine'])) {
// Don't offer to export views yet. // Don't offer to export views yet.
// continue; // continue;
//} //}
if ( ! empty( $unselectall ) if (! empty($unselectall)
|| ( isset( $tmp_select ) || (isset($tmp_select)
&& false !== strpos( $tmp_select, '|' . $each_table['Name'] . '|') ) ) { && false !== strpos($tmp_select, '|' . $each_table['Name'] . '|'))) {
$is_selected = ''; $is_selected = '';
} else { } else {
$is_selected = ' selected="selected"'; $is_selected = ' selected="selected"';
} }
$table_html = htmlspecialchars( $each_table['Name'] ); $table_html = htmlspecialchars($each_table['Name']);
$multi_values .= ' <option value="' . $table_html . '"' $multi_values .= ' <option value="' . $table_html . '"'
. $is_selected . '>' . $table_html . '</option>' . "\n"; . $is_selected . '>' . $table_html . '</option>' . "\n";
} // end for } // end for
@@ -56,7 +56,7 @@ $multi_values .= "\n";
$multi_values .= '</select></div>'; $multi_values .= '</select></div>';
$checkall_url = 'db_export.php?' $checkall_url = 'db_export.php?'
. PMA_generate_common_url( $db ) . PMA_generate_common_url($db)
. '&amp;goto=db_export.php'; . '&amp;goto=db_export.php';
$multi_values .= '<br /> $multi_values .= '<br />

View File

@@ -178,7 +178,7 @@ function showColumnSelectCell($columns, $column_number, $selected = '')
$z = 0; $z = 0;
for ($x = 0; $x < $col; $x++) { for ($x = 0; $x < $col; $x++) {
if (isset($ins_col[$x]) && $ins_col[$x] == 'on') { if (isset($ins_col[$x]) && $ins_col[$x] == 'on') {
showColumnSelectCell( $fld, $z ); showColumnSelectCell($fld, $z);
$z++; $z++;
} }
@@ -733,7 +733,7 @@ if (isset($Field) && count($Field) > 0) {
$master = key($tab_wher); $master = key($tab_wher);
} else { } else {
// Now let's find out which of the tables has an index // Now let's find out which of the tables has an index
// ( When the control user is the same as the normal user // (When the control user is the same as the normal user
// because he is using one of his databases as pmadb, // because he is using one of his databases as pmadb,
// the last db selected is not always the one where we need to work) // the last db selected is not always the one where we need to work)
PMA_DBI_select_db($db); PMA_DBI_select_db($db);
@@ -806,7 +806,7 @@ if (isset($Field) && count($Field) > 0) {
// Of course we only want to check each table once // Of course we only want to check each table once
$checked_tables = $col_cand; $checked_tables = $col_cand;
foreach ($col_cand AS $tab) { foreach ($col_cand AS $tab) {
if ($checked_tables[$tab] != 1 ) { if ($checked_tables[$tab] != 1) {
$tsize[$tab] = PMA_Table::countRecords($db, $tab, true, false); $tsize[$tab] = PMA_Table::countRecords($db, $tab, true, false);
$checked_tables[$tab] = 1; $checked_tables[$tab] = 1;
} }

View File

@@ -21,7 +21,7 @@ require_once './libraries/sql_query_form.lib.php';
* "db_structure.php" script where table can be created * "db_structure.php" script where table can be created
*/ */
require './libraries/db_info.inc.php'; require './libraries/db_info.inc.php';
if ( $num_tables == 0 && empty( $db_query_force ) ) { if ($num_tables == 0 && empty($db_query_force)) {
$sub_part = ''; $sub_part = '';
$is_info = TRUE; $is_info = TRUE;
require './db_structure.php'; require './db_structure.php';

View File

@@ -336,7 +336,7 @@ if ($save_on_server) {
* or not * or not
*/ */
if (!$save_on_server) { if (!$save_on_server) {
if ($asfile ) { if ($asfile) {
// Download // Download
if (!empty($content_encoding)) { if (!empty($content_encoding)) {
header('Content-Encoding: ' . $content_encoding); header('Content-Encoding: ' . $content_encoding);

View File

@@ -55,7 +55,7 @@ if (empty($HTTP_HOST)) {
// purge querywindow history // purge querywindow history
$cfgRelation = PMA_getRelationsParam(); $cfgRelation = PMA_getRelationsParam();
if ($GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork']) { if ($GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork']) {
PMA_purgeHistory( $GLOBALS['cfg']['Server']['user'] ); PMA_purgeHistory($GLOBALS['cfg']['Server']['user']);
} }
unset($cfgRelation); unset($cfgRelation);

View File

@@ -256,7 +256,7 @@ class PMA_Config
$this->set('PMA_IS_WINDOWS', 0); $this->set('PMA_IS_WINDOWS', 0);
// If PHP_OS is defined then continue // If PHP_OS is defined then continue
if (defined('PHP_OS')) { if (defined('PHP_OS')) {
if (stristr(PHP_OS, 'win') ) { if (stristr(PHP_OS, 'win')) {
// Is it some version of Windows // Is it some version of Windows
$this->set('PMA_IS_WINDOWS', 1); $this->set('PMA_IS_WINDOWS', 1);
} elseif (stristr(PHP_OS, 'OS/2')) { } elseif (stristr(PHP_OS, 'OS/2')) {
@@ -569,7 +569,7 @@ class PMA_Config
if (PMA_getenv('REQUEST_URI')) { if (PMA_getenv('REQUEST_URI')) {
$url = @parse_url(PMA_getenv('REQUEST_URI')); // produces E_WARNING if it cannot get parsed, e.g. '/foobar:/' $url = @parse_url(PMA_getenv('REQUEST_URI')); // produces E_WARNING if it cannot get parsed, e.g. '/foobar:/'
if ($url === false) { if ($url === false) {
$url = array( 'path' => $_SERVER['REQUEST_URI'] ); $url = array('path' => $_SERVER['REQUEST_URI']);
} }
} }

View File

@@ -1099,7 +1099,7 @@ class PMA_Sql
// so we track wether we are in the EXTRACT() // so we track wether we are in the EXTRACT()
$in_extract = FALSE; $in_extract = FALSE;
// for GROUP_CONCAT( ... ) // for GROUP_CONCAT(...)
$in_group_concat = FALSE; $in_group_concat = FALSE;
// must be sorted // must be sorted
@@ -1250,7 +1250,7 @@ class PMA_Sql
$previous_was_identifier = FALSE; $previous_was_identifier = FALSE;
$current_select_expr = -1; $current_select_expr = -1;
$seen_end_of_table_ref = FALSE; $seen_end_of_table_ref = FALSE;
} // end if ( data == SELECT) } // end if (data == SELECT)
if ($upper_data =='FROM' && ! $in_extract) { if ($upper_data =='FROM' && ! $in_extract) {
$current_table_ref = -1; $current_table_ref = -1;
@@ -1320,7 +1320,7 @@ class PMA_Sql
} // end if ($save_table_ref &&!$seen_end_of_table_ref) } // end if ($save_table_ref &&!$seen_end_of_table_ref)
} // end if (!$seen_from) } // end if (!$seen_from)
} // end if (querytype SELECT) } // end if (querytype SELECT)
} // end if ( quote_backtick or double quote or alpha_identifier) } // end if (quote_backtick or double quote or alpha_identifier)
// =================================== // ===================================
if ($each_parsed['type'] == 'punct_qualifier') { if ($each_parsed['type'] == 'punct_qualifier') {
@@ -1943,7 +1943,7 @@ class PMA_Sql
// (we got a bug report about not being able to use // (we got a bug report about not being able to use
// 'no' as an identifier) // 'no' as an identifier)
|| ($this->_parsed[$pos + 2]['type'] == 'alpha_identifier' || ($this->_parsed[$pos + 2]['type'] == 'alpha_identifier'
&& strtoupper($this->_parsed[$pos + 2]['data'])=='NO') ) && strtoupper($this->_parsed[$pos + 2]['data'])=='NO'))
) { ) {
$third_upper_data = strtoupper($this->_parsed[$pos + 2]['data']); $third_upper_data = strtoupper($this->_parsed[$pos + 2]['data']);
if ($third_upper_data == 'CASCADE' if ($third_upper_data == 'CASCADE'

View File

@@ -402,7 +402,7 @@ class PMA_Table {
} else { } else {
// Counting all rows of a VIEW could be too long, so use // Counting all rows of a VIEW could be too long, so use
// a LIMIT clause. // a LIMIT clause.
// Use try_query because it can fail ( a VIEW is based on // Use try_query because it can fail (a VIEW is based on
// a table that no longer exists) // a table that no longer exists)
$result = PMA_DBI_try_query( $result = PMA_DBI_try_query(
'SELECT 1 FROM ' . PMA_backquote($db) . '.' 'SELECT 1 FROM ' . PMA_backquote($db) . '.'

View File

@@ -108,8 +108,8 @@ class PMA_Theme_Manager
$this->theme = new PMA_Theme; $this->theme = new PMA_Theme;
if ( ! $this->checkTheme($GLOBALS['cfg']['ThemeDefault'])) { if (! $this->checkTheme($GLOBALS['cfg']['ThemeDefault'])) {
$GLOBALS['PMA_errors'][] = sprintf( $GLOBALS['strThemeDefaultNotFound'], $GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strThemeDefaultNotFound'],
htmlspecialchars($GLOBALS['cfg']['ThemeDefault'])); htmlspecialchars($GLOBALS['cfg']['ThemeDefault']));
trigger_error( trigger_error(
sprintf($GLOBALS['strThemeDefaultNotFound'], sprintf($GLOBALS['strThemeDefaultNotFound'],
@@ -148,7 +148,7 @@ class PMA_Theme_Manager
function setActiveTheme($theme = null) function setActiveTheme($theme = null)
{ {
if ( ! $this->checkTheme($theme)) { if (! $this->checkTheme($theme)) {
$GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strThemeNotFound'], $GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strThemeNotFound'],
htmlspecialchars($theme)); htmlspecialchars($theme));
/* Following code can lead to path disclossure, because headers will be sent later */ /* Following code can lead to path disclossure, because headers will be sent later */

View File

@@ -126,8 +126,8 @@ function PMA_auth_fails()
} }
PMA_mysqlDie($conn_error, '', true, '', false); PMA_mysqlDie($conn_error, '', true, '', false);
} }
if ( ! empty( $GLOBALS['PMA_errors'] ) && is_array( $GLOBALS['PMA_errors'] ) ) { if (! empty($GLOBALS['PMA_errors']) && is_array($GLOBALS['PMA_errors'])) {
foreach ( $GLOBALS['PMA_errors'] as $error ) { foreach ($GLOBALS['PMA_errors'] as $error) {
echo '<div class="error">' . $error . '</div>' . "\n"; echo '<div class="error">' . $error . '</div>' . "\n";
} }
} }

View File

@@ -103,7 +103,7 @@ function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id', $action_bo
$query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table']) $query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
. ($action_bookmark_all? '' : ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'' . ($action_bookmark_all? '' : ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
. ' OR user = \'\')' ) . ' OR user = \'\')')
. ' AND ' . PMA_backquote($id_field) . ' = ' . $id; . ' AND ' . PMA_backquote($id_field) . ' = ' . $id;
$result = PMA_DBI_try_query($query, $controllink); $result = PMA_DBI_try_query($query, $controllink);
if (!$result) { if (!$result) {

View File

@@ -153,7 +153,7 @@ function PMA_convert_display_charset($what) {
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding) if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
|| $convcharset == $charset // rabus: if input and output charset are the same, we don't have to do anything... || $convcharset == $charset // rabus: if input and output charset are the same, we don't have to do anything...
// this constant is not defined before the login: // this constant is not defined before the login:
|| (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) ) { // lem9: even if AllowAnywhereRecoding is TRUE, do not recode for MySQL >= 4.1.x since MySQL does the job || (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100)) { // lem9: even if AllowAnywhereRecoding is TRUE, do not recode for MySQL >= 4.1.x since MySQL does the job
return $what; return $what;
} elseif (is_array($what)) { } elseif (is_array($what)) {
$result = array(); $result = array();

View File

@@ -216,7 +216,7 @@ function PMA_unQuote($quoted_string, $quote = null)
foreach ($quotes as $quote) { foreach ($quotes as $quote) {
if (substr($quoted_string, 0, 1) === $quote if (substr($quoted_string, 0, 1) === $quote
&& substr($quoted_string, -1, 1) === $quote ) { && substr($quoted_string, -1, 1) === $quote) {
$unquoted_string = substr($quoted_string, 1, -1); $unquoted_string = substr($quoted_string, 1, -1);
// replace escaped quotes // replace escaped quotes
$unquoted_string = str_replace($quote . $quote, $quote, $unquoted_string); $unquoted_string = str_replace($quote . $quote, $quote, $unquoted_string);
@@ -732,7 +732,7 @@ function PMA_getTableList($db, $tables = null)
{ {
$sep = $GLOBALS['cfg']['LeftFrameTableSeparator']; $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
if ( null === $tables ) { if (null === $tables) {
$tables = PMA_DBI_get_tables_full($db); $tables = PMA_DBI_get_tables_full($db);
if ($GLOBALS['cfg']['NaturalOrder']) { if ($GLOBALS['cfg']['NaturalOrder']) {
uksort($tables, 'strnatcasecmp'); uksort($tables, 'strnatcasecmp');
@@ -1348,7 +1348,7 @@ function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false)
6 => 'E', 6 => 'E',
7 => 'Z', 7 => 'Z',
8 => 'Y' 8 => 'Y'
); );
// we need at least 3 digits to be displayed // we need at least 3 digits to be displayed
if (3 > $length + $comma) { if (3 > $length + $comma) {
@@ -1478,7 +1478,7 @@ function PMA_getTab($tab)
'args' => '', 'args' => '',
'warning' => '', 'warning' => '',
'fragment' => '', 'fragment' => '',
); );
$tab = array_merge($defaults, $tab); $tab = array_merge($defaults, $tab);

View File

@@ -21,11 +21,11 @@ define('PMA_DBI_GETVAR_GLOBAL', 2);
* *
* @param string $extension mysql extension to load * @param string $extension mysql extension to load
*/ */
function PMA_DBI_checkAndLoadMysqlExtension( $extension = 'mysql' ) { function PMA_DBI_checkAndLoadMysqlExtension($extension = 'mysql') {
if ( ! function_exists( $extension . '_connect' ) ) { if (! function_exists($extension . '_connect')) {
PMA_dl( $extension ); PMA_dl($extension);
// check whether mysql is available // check whether mysql is available
if ( ! function_exists( $extension . '_connect' ) ) { if (! function_exists($extension . '_connect')) {
return false; return false;
} }
} }
@@ -37,7 +37,7 @@ function PMA_DBI_checkAndLoadMysqlExtension( $extension = 'mysql' ) {
/** /**
* check for requested extension * check for requested extension
*/ */
if ( ! PMA_DBI_checkAndLoadMysqlExtension( $GLOBALS['cfg']['Server']['extension'] ) ) { if (! PMA_DBI_checkAndLoadMysqlExtension($GLOBALS['cfg']['Server']['extension'])) {
// if it fails try alternative extension ... // if it fails try alternative extension ...
// and display an error ... // and display an error ...
@@ -47,18 +47,18 @@ if ( ! PMA_DBI_checkAndLoadMysqlExtension( $GLOBALS['cfg']['Server']['extension'
* and complete fail (no alternativ extension too) * and complete fail (no alternativ extension too)
*/ */
$GLOBALS['PMA_errors'][] = $GLOBALS['PMA_errors'][] =
sprintf( PMA_sanitize( $GLOBALS['strCantLoad'] ), sprintf(PMA_sanitize($GLOBALS['strCantLoad']),
$GLOBALS['cfg']['Server']['extension'] ) $GLOBALS['cfg']['Server']['extension'])
.' - <a href="./Documentation.html#faqmysql" target="documentation">' .' - <a href="./Documentation.html#faqmysql" target="documentation">'
.$GLOBALS['strDocu'] . '</a>'; .$GLOBALS['strDocu'] . '</a>';
if ( $GLOBALS['cfg']['Server']['extension'] === 'mysql' ) { if ($GLOBALS['cfg']['Server']['extension'] === 'mysql') {
$alternativ_extension = 'mysqli'; $alternativ_extension = 'mysqli';
} else { } else {
$alternativ_extension = 'mysql'; $alternativ_extension = 'mysql';
} }
if ( ! PMA_DBI_checkAndLoadMysqlExtension( $alternativ_extension ) ) { if (! PMA_DBI_checkAndLoadMysqlExtension($alternativ_extension)) {
// if alternativ fails too ... // if alternativ fails too ...
PMA_fatalError( PMA_fatalError(
sprintf($GLOBALS['strCantLoad'], sprintf($GLOBALS['strCantLoad'],
@@ -68,7 +68,7 @@ if ( ! PMA_DBI_checkAndLoadMysqlExtension( $GLOBALS['cfg']['Server']['extension'
} }
$GLOBALS['cfg']['Server']['extension'] = $alternativ_extension; $GLOBALS['cfg']['Server']['extension'] = $alternativ_extension;
unset( $alternativ_extension ); unset($alternativ_extension);
} }
/** /**
@@ -104,7 +104,7 @@ function PMA_DBI_query($query, $link = null, $options = 0) {
* @param string $message * @param string $message
* @return string $message * @return string $message
*/ */
function PMA_DBI_convert_message( $message ) { function PMA_DBI_convert_message($message) {
// latin always last! // latin always last!
$encodings = array( $encodings = array(
'japanese' => 'EUC-JP', //'ujis', 'japanese' => 'EUC-JP', //'ujis',
@@ -133,33 +133,33 @@ function PMA_DBI_convert_message( $message ) {
'german' => 'CP1252', //'latin1', 'german' => 'CP1252', //'latin1',
); );
if ( $server_language = PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE \'language\';', 0, 1 ) ) { if ($server_language = PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'language\';', 0, 1)) {
$found = array(); $found = array();
if ( preg_match( '&(?:\\\|\\/)([^\\\\\/]*)(?:\\\|\\/)$&i', $server_language, $found )) { if (preg_match('&(?:\\\|\\/)([^\\\\\/]*)(?:\\\|\\/)$&i', $server_language, $found)) {
$server_language = $found[1]; $server_language = $found[1];
} }
} }
if ( ! empty( $server_language ) && isset( $encodings[$server_language] ) ) { if (! empty($server_language) && isset($encodings[$server_language])) {
if ( function_exists( 'iconv' ) ) { if (function_exists('iconv')) {
if ((@stristr(PHP_OS, 'AIX')) && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) { if ((@stristr(PHP_OS, 'AIX')) && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) {
require_once './libraries/iconv_wrapper.lib.php'; require_once './libraries/iconv_wrapper.lib.php';
$message = PMA_aix_iconv_wrapper( $encodings[$server_language], $message = PMA_aix_iconv_wrapper($encodings[$server_language],
$GLOBALS['charset'] . $GLOBALS['cfg']['IconvExtraParams'], $message); $GLOBALS['charset'] . $GLOBALS['cfg']['IconvExtraParams'], $message);
} else { } else {
$message = iconv( $encodings[$server_language], $message = iconv($encodings[$server_language],
$GLOBALS['charset'] . $GLOBALS['cfg']['IconvExtraParams'], $message); $GLOBALS['charset'] . $GLOBALS['cfg']['IconvExtraParams'], $message);
} }
} elseif ( function_exists( 'recode_string' ) ) { } elseif (function_exists('recode_string')) {
$message = recode_string( $encodings[$server_language] . '..' . $GLOBALS['charset'], $message = recode_string($encodings[$server_language] . '..' . $GLOBALS['charset'],
$message ); $message);
} elseif ( function_exists( 'libiconv' ) ) { } elseif (function_exists('libiconv')) {
$message = libiconv( $encodings[$server_language], $GLOBALS['charset'], $message ); $message = libiconv($encodings[$server_language], $GLOBALS['charset'], $message);
} elseif ( function_exists( 'mb_convert_encoding' ) ) { } elseif (function_exists('mb_convert_encoding')) {
// do not try unsupported charsets // do not try unsupported charsets
if ( ! in_array( $server_language, array( 'ukrainian', 'greek', 'serbian' ) ) ) { if (! in_array($server_language, array('ukrainian', 'greek', 'serbian'))) {
$message = mb_convert_encoding( $message, $GLOBALS['charset'], $message = mb_convert_encoding($message, $GLOBALS['charset'],
$encodings[$server_language] ); $encodings[$server_language]);
} }
} }
} else { } else {
@@ -194,10 +194,10 @@ function PMA_DBI_get_tables($database, $link = null)
* if $tbl_is_group is 'comment, $table is used as filter for table comments * if $tbl_is_group is 'comment, $table is used as filter for table comments
* *
* <code> * <code>
* PMA_DBI_get_tables_full( 'my_database' ); * PMA_DBI_get_tables_full('my_database');
* PMA_DBI_get_tables_full( 'my_database', 'my_table' ) ); * PMA_DBI_get_tables_full('my_database', 'my_table'));
* PMA_DBI_get_tables_full( 'my_database', 'my_tables_', true ) ); * PMA_DBI_get_tables_full('my_database', 'my_tables_', true));
* PMA_DBI_get_tables_full( 'my_database', 'my_tables_', 'comment' ) ); * PMA_DBI_get_tables_full('my_database', 'my_tables_', 'comment'));
* </code> * </code>
* *
* @uses PMA_MYSQL_INT_VERSION * @uses PMA_MYSQL_INT_VERSION
@@ -218,7 +218,7 @@ function PMA_DBI_get_tables_full($database, $table = false,
$tbl_is_group = false, $link = null) $tbl_is_group = false, $link = null)
{ {
// prepare and check parameters // prepare and check parameters
if ( ! is_array($database) ) { if (! is_array($database)) {
$databases = array(addslashes($database)); $databases = array(addslashes($database));
} else { } else {
$databases = array_map('addslashes', $database); $databases = array_map('addslashes', $database);
@@ -226,13 +226,13 @@ function PMA_DBI_get_tables_full($database, $table = false,
$tables = array(); $tables = array();
if ( PMA_MYSQL_INT_VERSION >= 50002 ) { if (PMA_MYSQL_INT_VERSION >= 50002) {
// get table information from information_schema // get table information from information_schema
if ( $table ) { if ($table) {
if ( true === $tbl_is_group ) { if (true === $tbl_is_group) {
$sql_where_table = 'AND `TABLE_NAME` LIKE \'' $sql_where_table = 'AND `TABLE_NAME` LIKE \''
. PMA_escape_mysql_wildcards(addslashes($table)) . '%\''; . PMA_escape_mysql_wildcards(addslashes($table)) . '%\'';
} elseif ( 'comment' === $tbl_is_group ) { } elseif ('comment' === $tbl_is_group) {
$sql_where_table = 'AND `TABLE_COMMENT` LIKE \'' $sql_where_table = 'AND `TABLE_COMMENT` LIKE \''
. PMA_escape_mysql_wildcards(addslashes($table)) . '%\''; . PMA_escape_mysql_wildcards(addslashes($table)) . '%\'';
} else { } else {
@@ -277,14 +277,14 @@ function PMA_DBI_get_tables_full($database, $table = false,
$tables = PMA_DBI_fetch_result($sql, array('TABLE_SCHEMA', 'TABLE_NAME'), $tables = PMA_DBI_fetch_result($sql, array('TABLE_SCHEMA', 'TABLE_NAME'),
null, $link); null, $link);
unset( $sql_where_table, $sql ); unset($sql_where_table, $sql);
} }
// If permissions are wrong on even one database directory, // If permissions are wrong on even one database directory,
// information_schema does not return any table info for any database // information_schema does not return any table info for any database
// this is why we fall back to SHOW TABLE STATUS even for MySQL >= 50002 // this is why we fall back to SHOW TABLE STATUS even for MySQL >= 50002
if ( PMA_MYSQL_INT_VERSION < 50002 || empty($tables)) { if (PMA_MYSQL_INT_VERSION < 50002 || empty($tables)) {
foreach ( $databases as $each_database ) { foreach ($databases as $each_database) {
if ( true === $tbl_is_group ) { if (true === $tbl_is_group) {
$sql = 'SHOW TABLE STATUS FROM ' $sql = 'SHOW TABLE STATUS FROM '
. PMA_backquote($each_database) . PMA_backquote($each_database)
.' LIKE \'' . PMA_escape_mysql_wildcards(addslashes($table)) . '%\''; .' LIKE \'' . PMA_escape_mysql_wildcards(addslashes($table)) . '%\'';
@@ -293,22 +293,22 @@ function PMA_DBI_get_tables_full($database, $table = false,
. PMA_backquote($each_database) . ';'; . PMA_backquote($each_database) . ';';
} }
$each_tables = PMA_DBI_fetch_result($sql, 'Name', null, $link); $each_tables = PMA_DBI_fetch_result($sql, 'Name', null, $link);
foreach ( $each_tables as $table_name => $each_table ) { foreach ($each_tables as $table_name => $each_table) {
if ( 'comment' === $tbl_is_group if ('comment' === $tbl_is_group
&& 0 === strpos($each_table['Comment'], $table) ) && 0 === strpos($each_table['Comment'], $table))
{ {
// remove table from list // remove table from list
unset( $each_tables[$table_name] ); unset($each_tables[$table_name]);
continue; continue;
} }
if ( ! isset( $each_tables[$table_name]['Type'] ) if (! isset($each_tables[$table_name]['Type'])
&& isset( $each_tables[$table_name]['Engine'] ) ) { && isset($each_tables[$table_name]['Engine'])) {
// pma BC, same parts of PMA still uses 'Type' // pma BC, same parts of PMA still uses 'Type'
$each_tables[$table_name]['Type'] $each_tables[$table_name]['Type']
=& $each_tables[$table_name]['Engine']; =& $each_tables[$table_name]['Engine'];
} elseif ( ! isset( $each_tables[$table_name]['Engine'] ) } elseif (! isset($each_tables[$table_name]['Engine'])
&& isset( $each_tables[$table_name]['Type'] ) ) { && isset($each_tables[$table_name]['Type'])) {
// old MySQL reports Type, newer MySQL reports Engine // old MySQL reports Type, newer MySQL reports Engine
$each_tables[$table_name]['Engine'] $each_tables[$table_name]['Engine']
=& $each_tables[$table_name]['Type']; =& $each_tables[$table_name]['Type'];
@@ -336,7 +336,7 @@ function PMA_DBI_get_tables_full($database, $table = false,
$each_tables[$table_name]['CREATE_OPTIONS'] =& $each_tables[$table_name]['Create_options']; $each_tables[$table_name]['CREATE_OPTIONS'] =& $each_tables[$table_name]['Create_options'];
$each_tables[$table_name]['TABLE_COMMENT'] =& $each_tables[$table_name]['Comment']; $each_tables[$table_name]['TABLE_COMMENT'] =& $each_tables[$table_name]['Comment'];
if ( strtoupper( $each_tables[$table_name]['Comment'] ) === 'VIEW' ) { if (strtoupper($each_tables[$table_name]['Comment']) === 'VIEW') {
$each_tables[$table_name]['TABLE_TYPE'] = 'VIEW'; $each_tables[$table_name]['TABLE_TYPE'] = 'VIEW';
} else { } else {
/** /**
@@ -350,8 +350,8 @@ function PMA_DBI_get_tables_full($database, $table = false,
} }
} }
if ( $GLOBALS['cfg']['NaturalOrder'] ) { if ($GLOBALS['cfg']['NaturalOrder']) {
foreach ( $tables as $key => $val ) { foreach ($tables as $key => $val) {
uksort($tables[$key], 'strnatcasecmp'); uksort($tables[$key], 'strnatcasecmp');
} }
} }
@@ -419,9 +419,9 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
} }
// get table information from information_schema // get table information from information_schema
if ( $database ) { if ($database) {
$sql_where_schema = 'WHERE `SCHEMA_NAME` LIKE \'' $sql_where_schema = 'WHERE `SCHEMA_NAME` LIKE \''
. addslashes( $database ) . '\''; . addslashes($database) . '\'';
} else { } else {
$sql_where_schema = ''; $sql_where_schema = '';
} }
@@ -484,11 +484,11 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
// so pma could use this array as if every server is of version >5.0 // so pma could use this array as if every server is of version >5.0
$databases[$database_name]['SCHEMA_NAME'] = $database_name; $databases[$database_name]['SCHEMA_NAME'] = $database_name;
if ( $force_stats ) { if ($force_stats) {
require_once 'mysql_charsets.lib.php'; require_once 'mysql_charsets.lib.php';
$databases[$database_name]['DEFAULT_COLLATION_NAME'] $databases[$database_name]['DEFAULT_COLLATION_NAME']
= PMA_getDbCollation( $database_name ); = PMA_getDbCollation($database_name);
// get additonal info about tables // get additonal info about tables
$databases[$database_name]['SCHEMA_TABLES'] = 0; $databases[$database_name]['SCHEMA_TABLES'] = 0;
@@ -499,8 +499,8 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
$databases[$database_name]['SCHEMA_LENGTH'] = 0; $databases[$database_name]['SCHEMA_LENGTH'] = 0;
$databases[$database_name]['SCHEMA_DATA_FREE'] = 0; $databases[$database_name]['SCHEMA_DATA_FREE'] = 0;
$res = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote( $database_name ) . ';'); $res = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($database_name) . ';');
while ( $row = PMA_DBI_fetch_assoc( $res ) ) { while ($row = PMA_DBI_fetch_assoc($res)) {
$databases[$database_name]['SCHEMA_TABLES']++; $databases[$database_name]['SCHEMA_TABLES']++;
$databases[$database_name]['SCHEMA_TABLE_ROWS'] $databases[$database_name]['SCHEMA_TABLE_ROWS']
+= $row['Rows']; += $row['Rows'];
@@ -515,8 +515,8 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
$databases[$database_name]['SCHEMA_LENGTH'] $databases[$database_name]['SCHEMA_LENGTH']
+= $row['Data_length'] + $row['Index_length']; += $row['Data_length'] + $row['Index_length'];
} }
PMA_DBI_free_result( $res ); PMA_DBI_free_result($res);
unset( $res ); unset($res);
} }
} }
} }
@@ -569,22 +569,22 @@ function PMA_DBI_get_columns_full($database = null, $table = null,
{ {
$columns = array(); $columns = array();
if ( PMA_MYSQL_INT_VERSION >= 50002 ) { if (PMA_MYSQL_INT_VERSION >= 50002) {
$sql_wheres = array(); $sql_wheres = array();
$array_keys = array(); $array_keys = array();
// get columns information from information_schema // get columns information from information_schema
if ( null !== $database ) { if (null !== $database) {
$sql_wheres[] = '`TABLE_SCHEMA` = \'' . addslashes($database) . '\' '; $sql_wheres[] = '`TABLE_SCHEMA` = \'' . addslashes($database) . '\' ';
} else { } else {
$array_keys[] = 'TABLE_SCHEMA'; $array_keys[] = 'TABLE_SCHEMA';
} }
if ( null !== $table ) { if (null !== $table) {
$sql_wheres[] = '`TABLE_NAME` = \'' . addslashes($table) . '\' '; $sql_wheres[] = '`TABLE_NAME` = \'' . addslashes($table) . '\' ';
} else { } else {
$array_keys[] = 'TABLE_NAME'; $array_keys[] = 'TABLE_NAME';
} }
if ( null !== $column ) { if (null !== $column) {
$sql_wheres[] = '`COLUMN_NAME` = \'' . addslashes($column) . '\' '; $sql_wheres[] = '`COLUMN_NAME` = \'' . addslashes($column) . '\' ';
} else { } else {
$array_keys[] = 'COLUMN_NAME'; $array_keys[] = 'COLUMN_NAME';
@@ -604,22 +604,22 @@ function PMA_DBI_get_columns_full($database = null, $table = null,
`PRIVILEGES` AS `Privileges`, `PRIVILEGES` AS `Privileges`,
`COLUMN_COMMENT` AS `Comment` `COLUMN_COMMENT` AS `Comment`
FROM `information_schema`.`COLUMNS`'; FROM `information_schema`.`COLUMNS`';
if ( count($sql_wheres) ) { if (count($sql_wheres)) {
$sql .= "\n" . ' WHERE ' . implode(' AND ', $sql_wheres); $sql .= "\n" . ' WHERE ' . implode(' AND ', $sql_wheres);
} }
$columns = PMA_DBI_fetch_result($sql, $array_keys, null, $link); $columns = PMA_DBI_fetch_result($sql, $array_keys, null, $link);
unset( $sql_wheres, $sql ); unset($sql_wheres, $sql);
} else { } else {
if ( null === $database ) { if (null === $database) {
foreach ($GLOBALS['PMA_List_Database']->items as $database) { foreach ($GLOBALS['PMA_List_Database']->items as $database) {
$columns[$database] = PMA_DBI_get_columns_full($database, null, $columns[$database] = PMA_DBI_get_columns_full($database, null,
null, $link); null, $link);
} }
return $columns; return $columns;
} elseif ( null === $table ) { } elseif (null === $table) {
$tables = PMA_DBI_get_tables($database); $tables = PMA_DBI_get_tables($database);
foreach ( $tables as $table ) { foreach ($tables as $table) {
$columns[$table] = PMA_DBI_get_columns_full( $columns[$table] = PMA_DBI_get_columns_full(
$database, $table, null, $link); $database, $table, null, $link);
} }
@@ -628,14 +628,14 @@ function PMA_DBI_get_columns_full($database = null, $table = null,
$sql = 'SHOW FULL COLUMNS FROM ' $sql = 'SHOW FULL COLUMNS FROM '
. PMA_backquote($database) . '.' . PMA_backquote($table); . PMA_backquote($database) . '.' . PMA_backquote($table);
if ( null !== $column ) { if (null !== $column) {
$sql .= " LIKE '" . $column . "'"; $sql .= " LIKE '" . $column . "'";
} }
$columns = PMA_DBI_fetch_result( $sql, 'Field', null, $link ); $columns = PMA_DBI_fetch_result($sql, 'Field', null, $link);
$ordinal_position = 1; $ordinal_position = 1;
foreach ( $columns as $column_name => $each_column ) { foreach ($columns as $column_name => $each_column) {
// MySQL forward compatibility // MySQL forward compatibility
// so pma could use this array as if every server is of version >5.0 // so pma could use this array as if every server is of version >5.0
@@ -673,7 +673,7 @@ function PMA_DBI_get_columns_full($database = null, $table = null,
$ordinal_position++; $ordinal_position++;
} }
if ( null !== $column ) { if (null !== $column) {
reset($columns); reset($columns);
$columns = current($columns); $columns = current($columns);
} }
@@ -699,7 +699,7 @@ function PMA_DBI_get_fields($database, $table, $link = null)
'SHOW FULL COLUMNS 'SHOW FULL COLUMNS
FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table), FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table),
null, null, $link); null, null, $link);
if ( ! is_array($fields) || count($fields) < 1 ) { if (! is_array($fields) || count($fields) < 1) {
return false; return false;
} }
return $fields; return $fields;
@@ -720,7 +720,7 @@ function PMA_DBI_get_columns($database, $table, $full = false, $link = null)
'SHOW ' . ($full ? 'FULL' : '') . ' COLUMNS 'SHOW ' . ($full ? 'FULL' : '') . ' COLUMNS
FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table), FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table),
'Fields', ($full ? null : 'Fields'), $link); 'Fields', ($full ? null : 'Fields'), $link);
if ( ! is_array($fields) || count($fields) < 1 ) { if (! is_array($fields) || count($fields) < 1) {
return false; return false;
} }
return $fields; return $fields;
@@ -794,7 +794,7 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
if (!defined('PMA_MYSQL_INT_VERSION')) { if (!defined('PMA_MYSQL_INT_VERSION')) {
$mysql_version = PMA_DBI_fetch_value( $mysql_version = PMA_DBI_fetch_value(
'SELECT VERSION()', 0, 0, $link, PMA_DBI_QUERY_STORE); 'SELECT VERSION()', 0, 0, $link, PMA_DBI_QUERY_STORE);
if ( $mysql_version ) { if ($mysql_version) {
$match = explode('.', $mysql_version); $match = explode('.', $mysql_version);
define('PMA_MYSQL_INT_VERSION', define('PMA_MYSQL_INT_VERSION',
(int) sprintf('%d%02d%02d', $match[0], $match[1], (int) sprintf('%d%02d%02d', $match[0], $match[1],
@@ -820,9 +820,9 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
// If $lang is defined and we are on MySQL >= 4.1.x, // If $lang is defined and we are on MySQL >= 4.1.x,
// we auto-switch the lang to its UTF-8 version (if it exists and user // we auto-switch the lang to its UTF-8 version (if it exists and user
// didn't force language) // didn't force language)
if ( !empty($GLOBALS['lang']) if (!empty($GLOBALS['lang'])
&& (substr($GLOBALS['lang'], -5) != 'utf-8') && (substr($GLOBALS['lang'], -5) != 'utf-8')
&& !isset($GLOBALS['cfg']['Lang']) ) { && !isset($GLOBALS['cfg']['Lang'])) {
$lang_utf_8_version = $lang_utf_8_version =
substr($GLOBALS['lang'], 0, strpos($GLOBALS['lang'], '-')) substr($GLOBALS['lang'], 0, strpos($GLOBALS['lang'], '-'))
. '-utf-8'; . '-utf-8';
@@ -835,16 +835,16 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
// and we remove the non-UTF-8 choices to avoid confusion // and we remove the non-UTF-8 choices to avoid confusion
if (!defined('PMA_REMOVED_NON_UTF_8')) { if (!defined('PMA_REMOVED_NON_UTF_8')) {
foreach ( $GLOBALS['available_languages'] as $each_lang => $dummy ) { foreach ($GLOBALS['available_languages'] as $each_lang => $dummy) {
if ( substr($each_lang, -5) != 'utf-8' ) { if (substr($each_lang, -5) != 'utf-8') {
unset( $GLOBALS['available_languages'][$each_lang] ); unset($GLOBALS['available_languages'][$each_lang]);
} }
} }
define('PMA_REMOVED_NON_UTF_8', 1); define('PMA_REMOVED_NON_UTF_8', 1);
} }
$mysql_charset = $GLOBALS['mysql_charset_map'][$GLOBALS['charset']]; $mysql_charset = $GLOBALS['mysql_charset_map'][$GLOBALS['charset']];
if ( $is_controluser if ($is_controluser
|| empty($GLOBALS['collation_connection']) || empty($GLOBALS['collation_connection'])
|| (strpos($GLOBALS['collation_connection'], '_') || (strpos($GLOBALS['collation_connection'], '_')
? substr($GLOBALS['collation_connection'], 0, strpos($GLOBALS['collation_connection'], '_')) ? substr($GLOBALS['collation_connection'], 0, strpos($GLOBALS['collation_connection'], '_'))
@@ -886,7 +886,7 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
* *
* <code> * <code>
* $sql = 'SELECT `name` FROM `user` WHERE `id` = 123'; * $sql = 'SELECT `name` FROM `user` WHERE `id` = 123';
* $user_name = PMA_DBI_fetch_value( $sql ); * $user_name = PMA_DBI_fetch_value($sql);
* // produces * // produces
* // $user_name = 'John Doe' * // $user_name = 'John Doe'
* </code> * </code>
@@ -908,37 +908,37 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
* @return mixed value of first field in first row from result * @return mixed value of first field in first row from result
* or false if not found * or false if not found
*/ */
function PMA_DBI_fetch_value( $result, $row_number = 0, $field = 0, $link = null, $options = 0 ) { function PMA_DBI_fetch_value($result, $row_number = 0, $field = 0, $link = null, $options = 0) {
$value = false; $value = false;
if ( is_string( $result ) ) { if (is_string($result)) {
$result = PMA_DBI_try_query( $result, $link, $options | PMA_DBI_QUERY_STORE ); $result = PMA_DBI_try_query($result, $link, $options | PMA_DBI_QUERY_STORE);
} }
// return false if result is empty or false // return false if result is empty or false
// or requested row is larger than rows in result // or requested row is larger than rows in result
if ( PMA_DBI_num_rows( $result ) < ( $row_number + 1 ) ) { if (PMA_DBI_num_rows($result) < ($row_number + 1)) {
return $value; return $value;
} }
// if $field is an integer use non associative mysql fetch function // if $field is an integer use non associative mysql fetch function
if ( is_int( $field ) ) { if (is_int($field)) {
$fetch_function = 'PMA_DBI_fetch_row'; $fetch_function = 'PMA_DBI_fetch_row';
} else { } else {
$fetch_function = 'PMA_DBI_fetch_assoc'; $fetch_function = 'PMA_DBI_fetch_assoc';
} }
// get requested row // get requested row
for ( $i = 0; $i <= $row_number; $i++ ) { for ($i = 0; $i <= $row_number; $i++) {
$row = $fetch_function( $result ); $row = $fetch_function($result);
} }
PMA_DBI_free_result( $result ); PMA_DBI_free_result($result);
// return requested field // return requested field
if ( isset( $row[$field] ) ) { if (isset($row[$field])) {
$value = $row[$field]; $value = $row[$field];
} }
unset( $row ); unset($row);
return $value; return $value;
} }
@@ -948,9 +948,9 @@ function PMA_DBI_fetch_value( $result, $row_number = 0, $field = 0, $link = null
* *
* <code> * <code>
* $sql = 'SELECT * FROM `user` WHERE `id` = 123'; * $sql = 'SELECT * FROM `user` WHERE `id` = 123';
* $user = PMA_DBI_fetch_single_row( $sql ); * $user = PMA_DBI_fetch_single_row($sql);
* // produces * // produces
* // $user = array( 'id' => 123, 'name' => 'John Doe' ) * // $user = array('id' => 123, 'name' => 'John Doe')
* </code> * </code>
* *
* @uses is_string() * @uses is_string()
@@ -969,17 +969,17 @@ function PMA_DBI_fetch_value( $result, $row_number = 0, $field = 0, $link = null
* @return array|boolean first row from result * @return array|boolean first row from result
* or false if result is empty * or false if result is empty
*/ */
function PMA_DBI_fetch_single_row( $result, $type = 'ASSOC', $link = null, $options = 0 ) { function PMA_DBI_fetch_single_row($result, $type = 'ASSOC', $link = null, $options = 0) {
if ( is_string( $result ) ) { if (is_string($result)) {
$result = PMA_DBI_try_query( $result, $link, $options | PMA_DBI_QUERY_STORE ); $result = PMA_DBI_try_query($result, $link, $options | PMA_DBI_QUERY_STORE);
} }
// return null if result is empty or false // return null if result is empty or false
if ( ! PMA_DBI_num_rows( $result ) ) { if (! PMA_DBI_num_rows($result)) {
return false; return false;
} }
switch ( $type ) { switch ($type) {
case 'NUM' : case 'NUM' :
$fetch_function = 'PMA_DBI_fetch_row'; $fetch_function = 'PMA_DBI_fetch_row';
break; break;
@@ -992,8 +992,8 @@ function PMA_DBI_fetch_single_row( $result, $type = 'ASSOC', $link = null, $opti
break; break;
} }
$row = $fetch_function( $result ); $row = $fetch_function($result);
PMA_DBI_free_result( $result ); PMA_DBI_free_result($result);
return $row; return $row;
} }
@@ -1002,29 +1002,29 @@ function PMA_DBI_fetch_single_row( $result, $type = 'ASSOC', $link = null, $opti
* *
* <code> * <code>
* $sql = 'SELECT * FROM `user`'; * $sql = 'SELECT * FROM `user`';
* $users = PMA_DBI_fetch_result( $sql ); * $users = PMA_DBI_fetch_result($sql);
* // produces * // produces
* // $users[] = array( 'id' => 123, 'name' => 'John Doe' ) * // $users[] = array('id' => 123, 'name' => 'John Doe')
* *
* $sql = 'SELECT `id`, `name` FROM `user`'; * $sql = 'SELECT `id`, `name` FROM `user`';
* $users = PMA_DBI_fetch_result( $sql, 'id' ); * $users = PMA_DBI_fetch_result($sql, 'id');
* // produces * // produces
* // $users['123'] = array( 'id' => 123, 'name' => 'John Doe' ) * // $users['123'] = array('id' => 123, 'name' => 'John Doe')
* *
* $sql = 'SELECT `id`, `name` FROM `user`'; * $sql = 'SELECT `id`, `name` FROM `user`';
* $users = PMA_DBI_fetch_result( $sql, 0 ); * $users = PMA_DBI_fetch_result($sql, 0);
* // produces * // produces
* // $users['123'] = array( 0 => 123, 1 => 'John Doe' ) * // $users['123'] = array(0 => 123, 1 => 'John Doe')
* *
* $sql = 'SELECT `id`, `name` FROM `user`'; * $sql = 'SELECT `id`, `name` FROM `user`';
* $users = PMA_DBI_fetch_result( $sql, 'id', 'name' ); * $users = PMA_DBI_fetch_result($sql, 'id', 'name');
* // or * // or
* $users = PMA_DBI_fetch_result( $sql, 0, 1 ); * $users = PMA_DBI_fetch_result($sql, 0, 1);
* // produces * // produces
* // $users['123'] = 'John Doe' * // $users['123'] = 'John Doe'
* *
* $sql = 'SELECT `name` FROM `user`'; * $sql = 'SELECT `name` FROM `user`';
* $users = PMA_DBI_fetch_result( $sql ); * $users = PMA_DBI_fetch_result($sql);
* // produces * // produces
* // $users[] = 'John Doe' * // $users[] = 'John Doe'
* </code> * </code>
@@ -1046,47 +1046,47 @@ function PMA_DBI_fetch_single_row( $result, $type = 'ASSOC', $link = null, $opti
* @param mixed $options * @param mixed $options
* @return array resultrows or values indexed by $key * @return array resultrows or values indexed by $key
*/ */
function PMA_DBI_fetch_result( $result, $key = null, $value = null, function PMA_DBI_fetch_result($result, $key = null, $value = null,
$link = null, $options = 0 ) $link = null, $options = 0)
{ {
$resultrows = array(); $resultrows = array();
if ( is_string($result) ) { if (is_string($result)) {
$result = PMA_DBI_try_query($result, $link, $options); $result = PMA_DBI_try_query($result, $link, $options);
} }
// return empty array if result is empty or false // return empty array if result is empty or false
if ( ! $result ) { if (! $result) {
return $resultrows; return $resultrows;
} }
$fetch_function = 'PMA_DBI_fetch_assoc'; $fetch_function = 'PMA_DBI_fetch_assoc';
// no nested array if only one field is in result // no nested array if only one field is in result
if ( null === $key && 1 === PMA_DBI_num_fields($result) ) { if (null === $key && 1 === PMA_DBI_num_fields($result)) {
$value = 0; $value = 0;
$fetch_function = 'PMA_DBI_fetch_row'; $fetch_function = 'PMA_DBI_fetch_row';
} }
// if $key is an integer use non associative mysql fetch function // if $key is an integer use non associative mysql fetch function
if ( is_int($key) ) { if (is_int($key)) {
$fetch_function = 'PMA_DBI_fetch_row'; $fetch_function = 'PMA_DBI_fetch_row';
} }
if ( null === $key && null === $value ) { if (null === $key && null === $value) {
while ( $row = $fetch_function($result) ) { while ($row = $fetch_function($result)) {
$resultrows[] = $row; $resultrows[] = $row;
} }
} elseif ( null === $key ) { } elseif (null === $key) {
while ( $row = $fetch_function($result) ) { while ($row = $fetch_function($result)) {
$resultrows[] = $row[$value]; $resultrows[] = $row[$value];
} }
} elseif ( null === $value ) { } elseif (null === $value) {
if ( is_array($key) ) { if (is_array($key)) {
while ( $row = $fetch_function($result) ) { while ($row = $fetch_function($result)) {
$result_target =& $resultrows; $result_target =& $resultrows;
foreach ( $key as $key_index ) { foreach ($key as $key_index) {
if ( ! isset( $result_target[$row[$key_index]] ) ) { if (! isset($result_target[$row[$key_index]])) {
$result_target[$row[$key_index]] = array(); $result_target[$row[$key_index]] = array();
} }
$result_target =& $result_target[$row[$key_index]]; $result_target =& $result_target[$row[$key_index]];
@@ -1094,16 +1094,16 @@ function PMA_DBI_fetch_result( $result, $key = null, $value = null,
$result_target = $row; $result_target = $row;
} }
} else { } else {
while ( $row = $fetch_function($result) ) { while ($row = $fetch_function($result)) {
$resultrows[$row[$key]] = $row; $resultrows[$row[$key]] = $row;
} }
} }
} else { } else {
if ( is_array($key) ) { if (is_array($key)) {
while ( $row = $fetch_function($result) ) { while ($row = $fetch_function($result)) {
$result_target =& $resultrows; $result_target =& $resultrows;
foreach ( $key as $key_index ) { foreach ($key as $key_index) {
if ( ! isset( $result_target[$row[$key_index]] ) ) { if (! isset($result_target[$row[$key_index]])) {
$result_target[$row[$key_index]] = array(); $result_target[$row[$key_index]] = array();
} }
$result_target =& $result_target[$row[$key_index]]; $result_target =& $result_target[$row[$key_index]];
@@ -1111,7 +1111,7 @@ function PMA_DBI_fetch_result( $result, $key = null, $value = null,
$result_target = $row[$value]; $result_target = $row[$value];
} }
} else { } else {
while ( $row = $fetch_function($result) ) { while ($row = $fetch_function($result)) {
$resultrows[$row[$key]] = $row[$value]; $resultrows[$row[$key]] = $row[$value];
} }
} }
@@ -1128,10 +1128,10 @@ function PMA_DBI_fetch_result( $result, $key = null, $value = null,
*/ */
function PMA_DBI_get_default_engine() function PMA_DBI_get_default_engine()
{ {
if ( PMA_MYSQL_INT_VERSION > 50002 ) { if (PMA_MYSQL_INT_VERSION > 50002) {
return PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE \'storage_engine\';', 0, 1 ); return PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'storage_engine\';', 0, 1);
} else { } else {
return PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE \'table_type\';', 0, 1 ); return PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'table_type\';', 0, 1);
} }
} }
@@ -1172,8 +1172,8 @@ function PMA_DBI_getCompatibilities()
* @return integer $is_superuser * @return integer $is_superuser
*/ */
function PMA_isSuperuser() { function PMA_isSuperuser() {
return PMA_DBI_try_query( 'SELECT COUNT(*) FROM mysql.user', return PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user',
$GLOBALS['userlink'], PMA_DBI_QUERY_STORE ); $GLOBALS['userlink'], PMA_DBI_QUERY_STORE);
} }
@@ -1214,6 +1214,6 @@ function PMA_DBI_get_procedure_or_function_def($db, $which, $proc_or_function_na
$returned_field = array('PROCEDURE' => 'Create Procedure', 'FUNCTION' => 'Create Function'); $returned_field = array('PROCEDURE' => 'Create Procedure', 'FUNCTION' => 'Create Function');
$query = 'SHOW CREATE ' . $which . ' ' . PMA_backquote($db) . '.' . PMA_backquote($proc_or_function_name); $query = 'SHOW CREATE ' . $which . ' ' . PMA_backquote($db) . '.' . PMA_backquote($proc_or_function_name);
return(PMA_DBI_fetch_value( $query, 0, $returned_field[$which])); return(PMA_DBI_fetch_value($query, 0, $returned_field[$which]));
} }
?> ?>

View File

@@ -15,7 +15,7 @@ PMA_checkParameters(array('db'));
$is_show_stats = $cfg['ShowStats']; $is_show_stats = $cfg['ShowStats'];
if ( PMA_MYSQL_INT_VERSION >= 50002 && $db == 'information_schema' ) { if (PMA_MYSQL_INT_VERSION >= 50002 && $db == 'information_schema') {
$is_show_stats = false; $is_show_stats = false;
$db_is_information_schema = true; $db_is_information_schema = true;
} else { } else {

View File

@@ -49,7 +49,7 @@ if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_info
/** /**
* export, search and qbe links if there is at least one table * export, search and qbe links if there is at least one table
*/ */
if ( $num_tables == 0 ) { if ($num_tables == 0) {
$tab_qbe['warning'] = $strDbIsEmpty; $tab_qbe['warning'] = $strDbIsEmpty;
$tab_search['warning'] = $strDbIsEmpty; $tab_search['warning'] = $strDbIsEmpty;
$tab_export['warning'] = $strDbIsEmpty; $tab_export['warning'] = $strDbIsEmpty;
@@ -82,7 +82,7 @@ if ($cfgRelation['designerwork']) {
$tab_designer['link'] = 'pmd_general.php'; $tab_designer['link'] = 'pmd_general.php';
} }
if ( ! $db_is_information_schema ) { if (! $db_is_information_schema) {
$tab_import['link'] = 'db_import.php'; $tab_import['link'] = 'db_import.php';
$tab_import['text'] = $GLOBALS['strImport']; $tab_import['text'] = $GLOBALS['strImport'];
$tab_import['icon'] = 'b_import.png'; $tab_import['icon'] = 'b_import.png';
@@ -92,7 +92,7 @@ if ( ! $db_is_information_schema ) {
$tab_operation['link'] = 'db_operations.php'; $tab_operation['link'] = 'db_operations.php';
$tab_operation['text'] = $GLOBALS['strOperations']; $tab_operation['text'] = $GLOBALS['strOperations'];
$tab_operation['icon'] = 'b_tblops.png'; $tab_operation['icon'] = 'b_tblops.png';
if ( $is_superuser ) { if ($is_superuser) {
$tab_privileges['link'] = 'server_privileges.php'; $tab_privileges['link'] = 'server_privileges.php';
$tab_privileges['args']['checkprivs'] = $db; $tab_privileges['args']['checkprivs'] = $db;
// stay on database view // stay on database view
@@ -111,22 +111,22 @@ $tabs[] =& $tab_sql;
$tabs[] =& $tab_search; $tabs[] =& $tab_search;
$tabs[] =& $tab_qbe; $tabs[] =& $tab_qbe;
$tabs[] =& $tab_export; $tabs[] =& $tab_export;
if ( ! $db_is_information_schema ) { if (! $db_is_information_schema) {
$tabs[] =& $tab_import; $tabs[] =& $tab_import;
if ($cfgRelation['designerwork']) { if ($cfgRelation['designerwork']) {
$tabs[] =& $tab_designer; $tabs[] =& $tab_designer;
} }
$tabs[] =& $tab_operation; $tabs[] =& $tab_operation;
if ( $is_superuser ) { if ($is_superuser) {
$tabs[] =& $tab_privileges; $tabs[] =& $tab_privileges;
} }
if ( $is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase'] ) { if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
$tabs[] =& $tab_drop; $tabs[] =& $tab_drop;
} }
} }
echo PMA_getTabs( $tabs ); echo PMA_getTabs($tabs);
unset( $tabs ); unset($tabs);
/** /**
* Displays a message * Displays a message

View File

@@ -18,7 +18,7 @@
* Of course the interface would need a way to pass calling parameters. * Of course the interface would need a way to pass calling parameters.
* Also, support DEFINER (like we do in export). * Also, support DEFINER (like we do in export).
*/ */
if ( PMA_MYSQL_INT_VERSION >= 50002 ) { if (PMA_MYSQL_INT_VERSION >= 50002) {
$url_query .= '&amp;goto=db_structure.php'; $url_query .= '&amp;goto=db_structure.php';
$routines = PMA_DBI_fetch_result('SELECT SPECIFIC_NAME,ROUTINE_NAME,ROUTINE_TYPE,DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';'); $routines = PMA_DBI_fetch_result('SELECT SPECIFIC_NAME,ROUTINE_NAME,ROUTINE_TYPE,DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';');

View File

@@ -10,13 +10,13 @@
* allways use $GLOBALS here, as this script is included by footer.inc.hp * allways use $GLOBALS here, as this script is included by footer.inc.hp
* which can also be included from inside a function * which can also be included from inside a function
*/ */
if ( $GLOBALS['cfg']['DBG']['enable'] ) { if ($GLOBALS['cfg']['DBG']['enable']) {
/** /**
* Loads the DBG extension if needed * Loads the DBG extension if needed
*/ */
if ( ! @extension_loaded('dbg') && ! PMA_dl('dbg') ) { if (! @extension_loaded('dbg') && ! PMA_dl('dbg')) {
echo '<div class="warning">' echo '<div class="warning">'
.sprintf( $GLOBALS['strCantLoad'], 'DBG' ) .sprintf($GLOBALS['strCantLoad'], 'DBG')
.' <a href="./Documentation.html#faqdbg" target="documentation">' .' <a href="./Documentation.html#faqdbg" target="documentation">'
.$GLOBALS['strDocu'] . '</a>' .$GLOBALS['strDocu'] . '</a>'
.'</div>'; .'</div>';

View File

@@ -194,9 +194,9 @@ function PMA_DBI_fetch_row($result) {
* @param result $result,... one or more mysql result resources * @param result $result,... one or more mysql result resources
*/ */
function PMA_DBI_free_result() { function PMA_DBI_free_result() {
foreach ( func_get_args() as $result ) { foreach (func_get_args() as $result) {
if ( is_resource($result) if (is_resource($result)
&& get_resource_type($result) === 'mysql result' ) { && get_resource_type($result) === 'mysql result') {
mysql_free_result($result); mysql_free_result($result);
} }
} }
@@ -298,7 +298,7 @@ function PMA_DBI_getError($link = null)
// Some errors messages cannot be obtained by mysql_error() // Some errors messages cannot be obtained by mysql_error()
if ($error_number == 2002) { if ($error_number == 2002) {
$error = '#' . ((string) $error_number) . ' - ' . $GLOBALS['strServerNotResponding'] . ' ' . $GLOBALS['strSocketProblem']; $error = '#' . ((string) $error_number) . ' - ' . $GLOBALS['strServerNotResponding'] . ' ' . $GLOBALS['strSocketProblem'];
} elseif ($error_number == 2003 ) { } elseif ($error_number == 2003) {
$error = '#' . ((string) $error_number) . ' - ' . $GLOBALS['strServerNotResponding']; $error = '#' . ((string) $error_number) . ' - ' . $GLOBALS['strServerNotResponding'];
} elseif (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) { } elseif (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) {
$error = '#' . ((string) $error_number) . ' - ' . $error_message; $error = '#' . ((string) $error_number) . ' - ' . $error_message;

View File

@@ -379,7 +379,7 @@ function PMA_DBI_get_host_info($link = null)
* @param resource $link mysql link * @param resource $link mysql link
* @return integer version of the MySQL protocol used * @return integer version of the MySQL protocol used
*/ */
function PMA_DBI_get_proto_info( $link = null ) function PMA_DBI_get_proto_info($link = null)
{ {
if (null === $link) { if (null === $link) {
if (isset($GLOBALS['userlink'])) { if (isset($GLOBALS['userlink'])) {

View File

@@ -39,7 +39,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100) {
$is_create_table_priv = true; $is_create_table_priv = true;
} }
foreach ( $dbs_where_create_table_allowed as $allowed_db ) { foreach ($dbs_where_create_table_allowed as $allowed_db) {
// if we find the exact db name, we stop here // if we find the exact db name, we stop here
if ($allowed_db == $db) { if ($allowed_db == $db) {
@@ -104,14 +104,14 @@ unset($i, $max_position, $chunk, $pattern);
<fieldset> <fieldset>
<legend> <legend>
<?php <?php
if ( $GLOBALS['cfg']['PropertiesIconic'] ) { if ($GLOBALS['cfg']['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage . 'b_newtbl.png" width="16" height="16" alt="" />'; echo '<img class="icon" src="' . $pmaThemeImage . 'b_newtbl.png" width="16" height="16" alt="" />';
} }
echo sprintf( $strCreateNewTable, PMA_getDbLink() ); echo sprintf($strCreateNewTable, PMA_getDbLink());
?> ?>
</legend> </legend>
<?php if ( $is_create_table_priv ) { ?> <?php if ($is_create_table_priv) { ?>
<?php echo PMA_generate_common_hidden_inputs( $db ); ?> <?php echo PMA_generate_common_hidden_inputs($db); ?>
<div class="formelement"> <div class="formelement">
<?php echo $strName; ?>: <?php echo $strName; ?>:
<input type="text" name="table" maxlength="64" size="30" /> <input type="text" name="table" maxlength="64" size="30" />

View File

@@ -80,7 +80,7 @@ echo PMA_pluginGetJavascript($export_list);
<fieldset id="exportoptions"> <fieldset id="exportoptions">
<legend><?php echo $strExport; ?></legend> <legend><?php echo $strExport; ?></legend>
<?php if ( ! empty( $multi_values ) ) { ?> <?php if (! empty($multi_values)) { ?>
<div class="formelementrow"> <div class="formelementrow">
<?php echo $multi_values; ?> <?php echo $multi_values; ?>
</div> </div>
@@ -102,12 +102,12 @@ echo PMA_pluginGetJavascript($export_list);
//]]> //]]>
</script> </script>
<?php if ( strlen($table) && ! isset( $num_tables ) ) { ?> <?php if (strlen($table) && ! isset($num_tables)) { ?>
<div class="formelementrow"> <div class="formelementrow">
<?php <?php
echo sprintf( $strDumpXRows, echo sprintf($strDumpXRows,
'<input type="text" name="limit_to" size="5" value="' '<input type="text" name="limit_to" size="5" value="'
. ( isset( $unlim_num_rows ) ? $unlim_num_rows : PMA_Table::countRecords( $db, $table, TRUE ) ) . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_Table::countRecords($db, $table, TRUE))
. '" onfocus="this.select()" />', . '" onfocus="this.select()" />',
'<input type="text" name="limit_from" value="0" size="5"' '<input type="text" name="limit_from" value="0" size="5"'
.' onfocus="this.select()" /> '); .' onfocus="this.select()" /> ');
@@ -201,11 +201,11 @@ echo PMA_pluginGetJavascript($export_list);
<?php <?php
// zip, gzip and bzip2 encode features // zip, gzip and bzip2 encode features
$is_zip = ( $cfg['ZipDump'] && @function_exists('gzcompress') ); $is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress'));
$is_gzip = ( $cfg['GZipDump'] && @function_exists('gzencode') ); $is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
$is_bzip = ( $cfg['BZipDump'] && @function_exists('bzcompress') ); $is_bzip = ($cfg['BZipDump'] && @function_exists('bzcompress'));
if ( $is_zip || $is_gzip || $is_bzip ) { ?> if ($is_zip || $is_gzip || $is_bzip) { ?>
<div class="formelementrow"> <div class="formelementrow">
<?php echo $strCompression; ?>: <?php echo $strCompression; ?>:
<input type="radio" name="compression" value="none" <input type="radio" name="compression" value="none"

View File

@@ -93,17 +93,17 @@ if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n"; echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n";
$temp_charset = reset($cfg['AvailableCharsets']); $temp_charset = reset($cfg['AvailableCharsets']);
echo ' <select id="charset_of_file" name="charset_of_file" size="1">' . "\n" echo ' <select id="charset_of_file" name="charset_of_file" size="1">' . "\n"
. ' <option value="' . htmlentities( $temp_charset ) . '"'; . ' <option value="' . htmlentities($temp_charset) . '"';
if ($temp_charset == $charset) { if ($temp_charset == $charset) {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo '>' . htmlentities( $temp_charset ) . '</option>' . "\n"; echo '>' . htmlentities($temp_charset) . '</option>' . "\n";
while ($temp_charset = next($cfg['AvailableCharsets'])) { while ($temp_charset = next($cfg['AvailableCharsets'])) {
echo ' <option value="' . htmlentities( $temp_charset ) . '"'; echo ' <option value="' . htmlentities($temp_charset) . '"';
if ($temp_charset == $charset) { if ($temp_charset == $charset) {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo '>' . htmlentities( $temp_charset ) . '</option>' . "\n"; echo '>' . htmlentities($temp_charset) . '</option>' . "\n";
} }
echo ' </select><br />' . "\n" . ' '; echo ' </select><br />' . "\n" . ' ';
} elseif (PMA_MYSQL_INT_VERSION >= 40100) { } elseif (PMA_MYSQL_INT_VERSION >= 40100) {
@@ -128,7 +128,7 @@ if ($cfg['ZipDump'] && @function_exists('gzinflate')) {
// We don't have show anything about compression, when no supported // We don't have show anything about compression, when no supported
if ($compressions != $strNone) { if ($compressions != $strNone) {
echo '<div class="formelementrow">' . "\n"; echo '<div class="formelementrow">' . "\n";
printf( $strCompressionWillBeDetected, $compressions); printf($strCompressionWillBeDetected, $compressions);
echo '</div>' . "\n"; echo '</div>' . "\n";
} }
echo "\n"; echo "\n";

View File

@@ -14,7 +14,7 @@
* @return the sorted array * @return the sorted array
* @access private * @access private
*/ */
function PMA_language_cmp( &$a, &$b ) { function PMA_language_cmp(&$a, &$b) {
return (strcmp($a[1], $b[1])); return (strcmp($a[1], $b[1]));
} // end of the 'PMA_language_cmp()' function } // end of the 'PMA_language_cmp()' function
@@ -51,9 +51,9 @@ function PMA_select_language($use_fieldset = FALSE) {
} }
$language_title = $GLOBALS['strLanguage'] . ($GLOBALS['strLanguage'] != 'Language' ? ' - Language' : '') . ' <a href="./translators.html" target="documentation">' . $language_title = $GLOBALS['strLanguage'] . ($GLOBALS['strLanguage'] != 'Language' ? ' - Language' : '') . ' <a href="./translators.html" target="documentation">' .
( $cfg['ReplaceHelpImg'] ? ($cfg['ReplaceHelpImg'] ?
'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />' : '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />' :
'(*)' ) . '</a>'; '(*)') . '</a>';
if ($use_fieldset) { if ($use_fieldset) {
echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>'; echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>';
} else { } else {

View File

@@ -13,7 +13,7 @@
/** /**
* *
*/ */
if ( $doWriteModifyAt == 'left' ){ if ($doWriteModifyAt == 'left') {
if (!empty($del_url) && $is_display['del_lnk'] != 'kp') { if (!empty($del_url) && $is_display['del_lnk'] != 'kp') {
echo ' <td align="center">' . "\n" echo ' <td align="center">' . "\n"

View File

@@ -189,7 +189,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine
SHOW STATUS SHOW STATUS
WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\'
OR Variable_name = \'Innodb_page_size\';'; OR Variable_name = \'Innodb_page_size\';';
$status = PMA_DBI_fetch_result( $sql, 0, 1 ); $status = PMA_DBI_fetch_result($sql, 0, 1);
$output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n" $output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n"
. ' <caption class="tblHeaders">' . "\n" . ' <caption class="tblHeaders">' . "\n"
@@ -321,7 +321,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine
*/ */
function getPage($id) function getPage($id)
{ {
if ( ! array_key_exists( $id, $this->getInfoPages() ) ) { if (! array_key_exists($id, $this->getInfoPages())) {
return false; return false;
} }

View File

@@ -71,7 +71,7 @@ xmlns="http://www.w3.org/TR/REC-html40">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html> <html>
<head> <head>
<meta http-equiv="Content-type" content="text/html;charset=' . ( isset($charset_of_file) ? $charset_of_file : $charset ) .'" /> <meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : $charset) .'" />
<style id="Classeur1_16681_Styles"> <style id="Classeur1_16681_Styles">
</style> </style>

View File

@@ -64,7 +64,7 @@ xmlns="http://www.w3.org/TR/REC-html40">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html> <html>
<head> <head>
<meta http-equiv="Content-type" content="text/html;charset=' . ( isset($charset_of_file) ? $charset_of_file : $charset ) .'" /> <meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : $charset) .'" />
</head> </head>
<body>'); <body>');
} }
@@ -324,10 +324,10 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>'; $schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>';
} }
if ($do_comments && $cfgRelation['commwork']) { if ($do_comments && $cfgRelation['commwork']) {
$schema_insert .= '<td class="print">' . ( isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>'; $schema_insert .= '<td class="print">' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>';
} }
if ($do_mime && $cfgRelation['mimework']) { if ($do_mime && $cfgRelation['mimework']) {
$schema_insert .= '<td class="print">' . ( isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>'; $schema_insert .= '<td class="print">' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>';
} }
$schema_insert .= '</tr>'; $schema_insert .= '</tr>';

View File

@@ -242,7 +242,8 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$buffer = ''; $buffer = '';
// print each row // print each row
for ($i = 0; $i < $columns_cnt; $i++) { for ($i = 0; $i < $columns_cnt; $i++) {
if ( isset($record[$columns[$i]]) && (!function_exists('is_null') || !is_null($record[$columns[$i]]))) { if (isset($record[$columns[$i]])
&& (! function_exists('is_null') || !is_null($record[$columns[$i]]))) {
$column_value = PMA_texEscape(stripslashes($record[$columns[$i]])); $column_value = PMA_texEscape(stripslashes($record[$columns[$i]]));
} else { } else {
$column_value = $GLOBALS['latex_null']; $column_value = $GLOBALS['latex_null'];

View File

@@ -127,7 +127,7 @@ $GLOBALS['comment_marker'] = '-- ';
/** /**
* Avoids undefined variables, use NULL so isset() returns false * Avoids undefined variables, use NULL so isset() returns false
*/ */
if ( ! isset( $sql_backquotes ) ) { if (! isset($sql_backquotes)) {
$sql_backquotes = null; $sql_backquotes = null;
} }
@@ -348,7 +348,7 @@ function PMA_exportDBFooter($db)
$procs_funcs .= PMA_DBI_get_procedure_or_function_def($db, 'FUNCTION', $function_name) . $crlf . $crlf; $procs_funcs .= PMA_DBI_get_procedure_or_function_def($db, 'FUNCTION', $function_name) . $crlf . $crlf;
} }
} }
if ( !empty($procs_funcs)) { if (!empty($procs_funcs)) {
$result = PMA_exportOutputHandler($procs_funcs); $result = PMA_exportOutputHandler($procs_funcs);
} }
} }

View File

@@ -157,7 +157,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
while ($record = PMA_DBI_fetch_row($result)) { while ($record = PMA_DBI_fetch_row($result)) {
$buffer = ' <' . $table . '>' . $crlf; $buffer = ' <' . $table . '>' . $crlf;
for ($i = 0; $i < $columns_cnt; $i++) { for ($i = 0; $i < $columns_cnt; $i++) {
if ( isset($record[$i]) && !is_null($record[$i])) { if (isset($record[$i]) && !is_null($record[$i])) {
$buffer .= ' <' . $columns[$i] . '>' . htmlspecialchars($record[$i]) $buffer .= ' <' . $columns[$i] . '>' . htmlspecialchars($record[$i])
. '</' . $columns[$i] . '>' . $crlf; . '</' . $columns[$i] . '>' . $crlf;
} }

View File

@@ -133,7 +133,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
$cnt++; $cnt++;
$buffer = $cnt . ":$crlf"; $buffer = $cnt . ":$crlf";
for ($i = 0; $i < $columns_cnt; $i++) { for ($i = 0; $i < $columns_cnt; $i++) {
if ( isset($record[$i]) && !is_null($record[$i])) { if (isset($record[$i]) && !is_null($record[$i])) {
$buffer .= ' ' . $columns[$i] . ': ' . htmlspecialchars($record[$i]) . $crlf; $buffer .= ' ' . $columns[$i] . ': ' . htmlspecialchars($record[$i]) . $crlf;
} }
} }

View File

@@ -25,11 +25,11 @@
*/ */
function PMA_gpc_extract($array, &$target, $sanitize = true) function PMA_gpc_extract($array, &$target, $sanitize = true)
{ {
if ( ! is_array($array) ) { if (! is_array($array)) {
return false; return false;
} }
if ( $sanitize ) { if ($sanitize) {
$valid_variables = preg_replace($GLOBALS['_import_blacklist'], '', $valid_variables = preg_replace($GLOBALS['_import_blacklist'], '',
array_keys($array)); array_keys($array));
$valid_variables = array_unique($valid_variables); $valid_variables = array_unique($valid_variables);
@@ -37,16 +37,16 @@ function PMA_gpc_extract($array, &$target, $sanitize = true)
$valid_variables = array_keys($array); $valid_variables = array_keys($array);
} }
foreach ( $valid_variables as $key ) { foreach ($valid_variables as $key) {
if ( strlen($key) === 0 ) { if (strlen($key) === 0) {
continue; continue;
} }
if ( is_array($array[$key]) ) { if (is_array($array[$key])) {
// there could be a variable coming from a cookie of // there could be a variable coming from a cookie of
// another application, with the same name as this array // another application, with the same name as this array
unset( $target[$key] ); unset($target[$key]);
PMA_gpc_extract($array[$key], $target[$key], false); PMA_gpc_extract($array[$key], $target[$key], false);
} else { } else {

View File

@@ -180,46 +180,46 @@ if (empty($GLOBALS['is_header_sent'])) {
) )
); );
$item = '<a href="%1$s?%2$s" class="item">'; $item = '<a href="%1$s?%2$s" class="item">';
if ( $GLOBALS['cfg']['NavigationBarIconic'] ) { if ($GLOBALS['cfg']['NavigationBarIconic']) {
$separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n"; $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n";
$item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n"; $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
} else { } else {
$separator = ' <span class="separator"> - </span>' . "\n"; $separator = ' <span class="separator"> - </span>' . "\n";
} }
if ( $GLOBALS['cfg']['NavigationBarIconic'] !== true ) { if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
$item .= '%4$s: '; $item .= '%4$s: ';
} }
$item .= '%3$s</a>' . "\n"; $item .= '%3$s</a>' . "\n";
echo '<div id="serverinfo">' . "\n"; echo '<div id="serverinfo">' . "\n";
printf( $item, printf($item,
$GLOBALS['cfg']['DefaultTabServer'], $GLOBALS['cfg']['DefaultTabServer'],
PMA_generate_common_url(), PMA_generate_common_url(),
htmlspecialchars($server_info), htmlspecialchars($server_info),
$GLOBALS['strServer'], $GLOBALS['strServer'],
's_host.png' ); 's_host.png');
if (strlen($GLOBALS['db'])) { if (strlen($GLOBALS['db'])) {
echo $separator; echo $separator;
printf( $item, printf($item,
$GLOBALS['cfg']['DefaultTabDatabase'], $GLOBALS['cfg']['DefaultTabDatabase'],
PMA_generate_common_url($GLOBALS['db']), PMA_generate_common_url($GLOBALS['db']),
htmlspecialchars($GLOBALS['db']), htmlspecialchars($GLOBALS['db']),
$GLOBALS['strDatabase'], $GLOBALS['strDatabase'],
's_db.png' ); 's_db.png');
if (strlen($GLOBALS['table'])) { if (strlen($GLOBALS['table'])) {
require_once './libraries/tbl_info.inc.php'; require_once './libraries/tbl_info.inc.php';
echo $separator; echo $separator;
printf( $item, printf($item,
$GLOBALS['cfg']['DefaultTabTable'], $GLOBALS['cfg']['DefaultTabTable'],
PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']), PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
htmlspecialchars($GLOBALS['table']), htmlspecialchars($GLOBALS['table']),
(isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable']), (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable']),
(isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png' ); (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
/** /**
* Displays table comment * Displays table comment
@@ -245,12 +245,12 @@ if (empty($GLOBALS['is_header_sent'])) {
// Get additional information about tables for tooltip is done // Get additional information about tables for tooltip is done
// in libraries/db_info.inc.php only once // in libraries/db_info.inc.php only once
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
$comment = PMA_getComments( $GLOBALS['db'] ); $comment = PMA_getComments($GLOBALS['db']);
/** /**
* Displays table comment * Displays table comment
*/ */
if ( is_array( $comment ) ) { if (is_array($comment)) {
echo '<span class="table_comment"' echo '<span class="table_comment"'
.' id="span_table_comment">&quot;' .' id="span_table_comment">&quot;'
.htmlspecialchars(implode(' ', $comment)) .htmlspecialchars(implode(' ', $comment))

View File

@@ -44,7 +44,7 @@ if ($text_dir == 'ltr') {
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<title><?php echo $strSQLResult; ?> - phpMyAdmin <?php echo PMA_VERSION ?></title> <title><?php echo $strSQLResult; ?> - phpMyAdmin <?php echo PMA_VERSION ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
<link rel="stylesheet" type="text/css" href="phpmyadmin.css.php?<?php echo PMA_generate_common_url( '', '' ); ?>&amp;js_frame=print&amp;nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" /> <link rel="stylesheet" type="text/css" href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=print&amp;nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
</style> </style>
</head> </head>

View File

@@ -56,7 +56,7 @@ function PMA_aix_iconv_wrapper($in_charset, $out_charset, $str) {
$using_translit = (!($translit_search === FALSE)); $using_translit = (!($translit_search === FALSE));
// Extract "plain" output character set name (without any transliteration argument) // Extract "plain" output character set name (without any transliteration argument)
$out_charset_plain = ( $using_translit ? substr($out_charset, 0, $translit_search) : $out_charset ); $out_charset_plain = ($using_translit ? substr($out_charset, 0, $translit_search) : $out_charset);
// Transform name of input character set (if found) // Transform name of input character set (if found)
if (array_key_exists(strtolower($in_charset), $gnu_iconv_to_aix_iconv_codepage_map)) { if (array_key_exists(strtolower($in_charset), $gnu_iconv_to_aix_iconv_codepage_map)) {
@@ -70,7 +70,7 @@ function PMA_aix_iconv_wrapper($in_charset, $out_charset, $str) {
// Add transliteration argument again (exactly as specified by user) if used // Add transliteration argument again (exactly as specified by user) if used
// Build the output character set name that we will use // Build the output character set name that we will use
$out_charset = ( $using_translit ? $out_charset_plain . substr($out_charset, $translit_search) : $out_charset_plain ); $out_charset = ($using_translit ? $out_charset_plain . substr($out_charset, $translit_search) : $out_charset_plain);
// NOTE: Transliteration not supported; we will use the "plain" output character set name // NOTE: Transliteration not supported; we will use the "plain" output character set name
$out_charset = $out_charset_plain; $out_charset = $out_charset_plain;

View File

@@ -57,7 +57,7 @@ if ($data === TRUE && !$error && !$timeout_passed) {
$qry = ' $qry = '
INSERT INTO INSERT INTO
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
( db_name, table_name, column_name, ' . PMA_backquote('comment') . ' ) (db_name, table_name, column_name, ' . PMA_backquote('comment') . ')
VALUES ( VALUES (
\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\', \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',
\'' . PMA_sqlAddslashes(trim($tab)) . '\', \'' . PMA_sqlAddslashes(trim($tab)) . '\',
@@ -70,7 +70,7 @@ if ($data === TRUE && !$error && !$timeout_passed) {
$qry = ' $qry = '
INSERT INTO INSERT INTO
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['relation']) . ' ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['relation']) . '
( master_db, master_table, master_field, foreign_db, foreign_table, foreign_field) (master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)
VALUES ( VALUES (
\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\', \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',
\'' . PMA_sqlAddslashes(trim($tab)) . '\', \'' . PMA_sqlAddslashes(trim($tab)) . '\',

View File

@@ -217,7 +217,7 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) {
} }
} }
// Change delimiter, if redefined, and skip it (don't send to server!) // Change delimiter, if redefined, and skip it (don't send to server!)
if ((substr($buffer, $i, 9) == "DELIMITER") && ($buffer[$i + 9] <= ' ') && ($i<$len-11) && (!(strpos($buffer,"\n",$i+11)===FALSE) )) { if ((substr($buffer, $i, 9) == "DELIMITER") && ($buffer[$i + 9] <= ' ') && ($i<$len-11) && (!(strpos($buffer,"\n",$i+11)===FALSE))) {
$new_line_pos = strpos($buffer, "\n", $i + 10); $new_line_pos = strpos($buffer, "\n", $i + 10);
$sql_delimiter = substr($buffer, $i+10, $new_line_pos - $i -10); $sql_delimiter = substr($buffer, $i+10, $new_line_pos - $i -10);
$i= $new_line_pos + 1; $i= $new_line_pos + 1;

View File

@@ -8,13 +8,12 @@
/** /**
* Prepares the work and runs some other scripts if required * Prepares the work and runs some other scripts if required
*/ */
if (!empty($submit_mult) if (! empty($submit_mult)
&& ($submit_mult != $strWithChecked) && $submit_mult != $strWithChecked
&& ( ( isset($selected_db) && !empty($selected_db) ) && (! empty($selected_db)
|| ( isset($selected_tbl) && !empty($selected_tbl) ) || ! empty($selected_tbl)
|| ( isset($selected_fld) && !empty($selected_fld) ) || ! empty($selected_fld)
|| !empty($rows_to_delete) || ! empty($rows_to_delete))) {
)) {
define('PMA_SUBMIT_MULT', 1); define('PMA_SUBMIT_MULT', 1);
if (isset($selected_db) && !empty($selected_db)) { if (isset($selected_db) && !empty($selected_db)) {
$selected = $selected_db; $selected = $selected_db;
@@ -125,7 +124,7 @@ if (!empty($submit_mult)
/** /**
* Displays the confirmation form if required * Displays the confirmation form if required
*/ */
if ( !empty($submit_mult) && !empty($what)) { if (!empty($submit_mult) && !empty($what)) {
$js_to_run = 'functions.js'; $js_to_run = 'functions.js';
unset($message); unset($message);
if (strlen($table)) { if (strlen($table)) {
@@ -257,7 +256,7 @@ if ( !empty($submit_mult) && !empty($what)) {
echo '<input type="hidden" name="disp_direction" value="' . $disp_direction . '" />' . "\n"; echo '<input type="hidden" name="disp_direction" value="' . $disp_direction . '" />' . "\n";
echo '<input type="hidden" name="repeat_cells" value="' . $repeat_cells . '" />' . "\n"; echo '<input type="hidden" name="repeat_cells" value="' . $repeat_cells . '" />' . "\n";
echo '<input type="hidden" name="dontlimitchars" value="' . $dontlimitchars . '" />' . "\n"; echo '<input type="hidden" name="dontlimitchars" value="' . $dontlimitchars . '" />' . "\n";
echo '<input type="hidden" name="pos" value="' . ( isset( $pos ) ? $pos : 0 ) . '" />' . "\n"; echo '<input type="hidden" name="pos" value="' . (isset($pos) ? $pos : 0) . '" />' . "\n";
echo '<input type="hidden" name="session_max_rows" value="' . $session_max_rows . '" />' . "\n"; echo '<input type="hidden" name="session_max_rows" value="' . $session_max_rows . '" />' . "\n";
} }
?> ?>
@@ -375,7 +374,7 @@ elseif ($mult_btn == $strYes) {
break; break;
case 'primary_fld': case 'primary_fld':
$sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ( empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( ' : ', ') $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . (empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( ' : ', ')
. PMA_backquote(urldecode($selected[$i])) . PMA_backquote(urldecode($selected[$i]))
. (($i == $selected_cnt-1) ? ');' : ''); . (($i == $selected_cnt-1) ? ');' : '');
break; break;

View File

@@ -19,7 +19,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
//$mysql_charsets_maxlen[$row['Charset']] = $row['Maxlen']; //$mysql_charsets_maxlen[$row['Charset']] = $row['Maxlen'];
$mysql_charsets_descriptions[$row['Charset']] = $row['Description']; $mysql_charsets_descriptions[$row['Charset']] = $row['Description'];
} }
@PMA_DBI_free_result( $res ); @PMA_DBI_free_result($res);
$mysql_charsets_count = count($mysql_charsets); $mysql_charsets_count = count($mysql_charsets);
sort($mysql_charsets, SORT_STRING); sort($mysql_charsets, SORT_STRING);
@@ -42,8 +42,8 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
$mysql_collations_available[$row['Collation']] = TRUE; $mysql_collations_available[$row['Collation']] = TRUE;
$mysql_charsets_available[$row['Charset']] = !empty($mysql_charsets_available[$row['Charset']]) || !empty($mysql_collations_available[$row['Collation']]); $mysql_charsets_available[$row['Charset']] = !empty($mysql_charsets_available[$row['Charset']]) || !empty($mysql_collations_available[$row['Collation']]);
} }
@PMA_DBI_free_result( $res ); @PMA_DBI_free_result($res);
unset( $res, $row ); unset($res, $row);
$mysql_collations_count = count($mysql_collations_flat); $mysql_collations_count = count($mysql_collations_flat);
sort($mysql_collations_flat, SORT_STRING); sort($mysql_collations_flat, SORT_STRING);
@@ -51,7 +51,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
sort($mysql_collations[$key], SORT_STRING); sort($mysql_collations[$key], SORT_STRING);
reset($mysql_collations[$key]); reset($mysql_collations[$key]);
} }
unset( $key, $value ); unset($key, $value);
define('PMA_CSDROPDOWN_COLLATION', 0); define('PMA_CSDROPDOWN_COLLATION', 0);
define('PMA_CSDROPDOWN_CHARSET', 1); define('PMA_CSDROPDOWN_CHARSET', 1);
@@ -114,24 +114,24 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
* @param string $db name of db * @param string $db name of db
* @return string collation of $db * @return string collation of $db
*/ */
function PMA_getDbCollation( $db ) { function PMA_getDbCollation($db) {
if ( PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema' ) { if (PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema') {
// We don't have to check the collation of the virtual // We don't have to check the collation of the virtual
// information_schema database: We know it! // information_schema database: We know it!
return 'utf8_general_ci'; return 'utf8_general_ci';
} }
if ( PMA_MYSQL_INT_VERSION >= 50006 ) { if (PMA_MYSQL_INT_VERSION >= 50006) {
// Since MySQL 5.0.6, we don't have to parse SHOW CREATE DATABASE anymore. // Since MySQL 5.0.6, we don't have to parse SHOW CREATE DATABASE anymore.
return PMA_DBI_fetch_value('SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = \'' . PMA_sqlAddSlashes($db) . '\' LIMIT 1;'); return PMA_DBI_fetch_value('SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = \'' . PMA_sqlAddSlashes($db) . '\' LIMIT 1;');
} elseif ( PMA_MYSQL_INT_VERSION >= 40101 ) { } elseif (PMA_MYSQL_INT_VERSION >= 40101) {
// MySQL 4.1.0 does not support seperate charset settings // MySQL 4.1.0 does not support seperate charset settings
// for databases. // for databases.
PMA_DBI_select_db( $db ); PMA_DBI_select_db($db);
// the query does not work if this string is in double quotes // the query does not work if this string is in double quotes
// and MySQL is running in ANSI mode // and MySQL is running in ANSI mode
$return = PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE \'collation_database\'', 0, 1 ); $return = PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'collation_database\'', 0, 1);
if ( isset( $GLOBALS['db'] ) && $db !== $GLOBALS['db'] ) { if (isset($GLOBALS['db']) && $db !== $GLOBALS['db']) {
PMA_DBI_select_db( $GLOBALS['db'] ); PMA_DBI_select_db($GLOBALS['db']);
} }
return $return; return $return;
} }
@@ -139,7 +139,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
} }
} else { } else {
function PMA_getDbCollation( $db ) { return PMA_getServerCollation(); } function PMA_getDbCollation($db) { return PMA_getServerCollation(); }
} }
/** /**
@@ -150,7 +150,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
*/ */
function PMA_getServerCollation() { function PMA_getServerCollation() {
return PMA_DBI_fetch_value( return PMA_DBI_fetch_value(
'SHOW VARIABLES LIKE \'collation_server\'', 0, 1 ); 'SHOW VARIABLES LIKE \'collation_server\'', 0, 1);
} }
/** /**
@@ -164,7 +164,7 @@ function PMA_getServerCollation() {
* @param string $collation MySQL collation string * @param string $collation MySQL collation string
* @return string collation description * @return string collation description
*/ */
function PMA_getCollationDescr( $collation ) { function PMA_getCollationDescr($collation) {
static $collation_cache; static $collation_cache;
if (!is_array($collation_cache)) { if (!is_array($collation_cache)) {

View File

@@ -9,19 +9,19 @@
/** /**
* *
*/ */
if ( empty( $query_url ) ) { if (empty($query_url)) {
$db = ! isset( $db ) ? '' : $db; $db = ! isset($db) ? '' : $db;
$table = ! isset( $table ) ? '' : $table; $table = ! isset($table) ? '' : $table;
$query_url = PMA_generate_common_url( $db, $table ); $query_url = PMA_generate_common_url($db, $table);
} }
// display Logo, depending on $GLOBALS['cfg']['LeftDisplayLogo'] // display Logo, depending on $GLOBALS['cfg']['LeftDisplayLogo']
if ( $GLOBALS['cfg']['LeftDisplayLogo'] ) { if ($GLOBALS['cfg']['LeftDisplayLogo']) {
$logo = 'phpMyAdmin'; $logo = 'phpMyAdmin';
if ( @file_exists( $GLOBALS['pmaThemeImage'] . 'logo_left.png' ) ) { if (@file_exists($GLOBALS['pmaThemeImage'] . 'logo_left.png')) {
$logo = '<img src="' . $GLOBALS['pmaThemeImage'] . 'logo_left.png" ' $logo = '<img src="' . $GLOBALS['pmaThemeImage'] . 'logo_left.png" '
.'alt="' . $logo . '" id="imgpmalogo" />'; .'alt="' . $logo . '" id="imgpmalogo" />';
} elseif ( @file_exists( $GLOBALS['pmaThemeImage'] . 'pma_logo2.png' ) ) { } elseif (@file_exists($GLOBALS['pmaThemeImage'] . 'pma_logo2.png')) {
$logo = '<img src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo2.png" ' $logo = '<img src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo2.png" '
.'alt="' . $logo . '" id="imgpmalogo" />'; .'alt="' . $logo . '" id="imgpmalogo" />';
} }
@@ -43,27 +43,27 @@ if ( $GLOBALS['cfg']['LeftDisplayLogo'] ) {
<?php <?php
echo '<a href="main.php?' . $query_url . '"' echo '<a href="main.php?' . $query_url . '"'
.' title="' . $strHome . '">' .' title="' . $strHome . '">'
.( $GLOBALS['cfg']['MainPageIconic'] .($GLOBALS['cfg']['MainPageIconic']
? '<img class="icon" src="' . $pmaThemeImage . 'b_home.png" width="16" ' ? '<img class="icon" src="' . $pmaThemeImage . 'b_home.png" width="16" '
.' height="16" alt="' . $strHome . '" />' .' height="16" alt="' . $strHome . '" />'
: $strHome ) : $strHome)
.'</a>' . "\n"; .'</a>' . "\n";
// if we have chosen server // if we have chosen server
if ( $server != 0 ) { if ($server != 0) {
// Logout for advanced authentication // Logout for advanced authentication
if ( $GLOBALS['cfg']['Server']['auth_type'] != 'config' ) { if ($GLOBALS['cfg']['Server']['auth_type'] != 'config') {
echo ($GLOBALS['cfg']['MainPageIconic'] ? '' : ' - '); echo ($GLOBALS['cfg']['MainPageIconic'] ? '' : ' - ');
echo '<a href="index.php?' . $query_url . '&amp;old_usr=' echo '<a href="index.php?' . $query_url . '&amp;old_usr='
.urlencode($PHP_AUTH_USER) . '" target="_parent"' .urlencode($PHP_AUTH_USER) . '" target="_parent"'
.' title="' . $strLogout . '" >' .' title="' . $strLogout . '" >'
.( $GLOBALS['cfg']['MainPageIconic'] .($GLOBALS['cfg']['MainPageIconic']
? '<img class="icon" src="' . $pmaThemeImage . 's_loggoff.png" ' ? '<img class="icon" src="' . $pmaThemeImage . 's_loggoff.png" '
.' width="16" height="16" alt="' . $strLogout . '" />' .' width="16" height="16" alt="' . $strLogout . '" />'
: $strLogout ) : $strLogout)
.'</a>' . "\n"; .'</a>' . "\n";
} // end if ($GLOBALS['cfg']['Server']['auth_type'] != 'config' } // end if ($GLOBALS['cfg']['Server']['auth_type'] != 'config'
$anchor = 'querywindow.php?' . PMA_generate_common_url( $db, $table ); $anchor = 'querywindow.php?' . PMA_generate_common_url($db, $table);
if ($GLOBALS['cfg']['MainPageIconic']) { if ($GLOBALS['cfg']['MainPageIconic']) {
$query_frame_link_text = $query_frame_link_text =

View File

@@ -124,7 +124,7 @@ function PMA_pluginGetDefault($section, $opt)
*/ */
function PMA_pluginIsActive($section, $opt, $val) function PMA_pluginIsActive($section, $opt, $val)
{ {
if ( ! empty($GLOBALS['timeout_passed']) && isset($_REQUEST[$opt])) { if (! empty($GLOBALS['timeout_passed']) && isset($_REQUEST[$opt])) {
if ($_REQUEST[$opt] == $val) { if ($_REQUEST[$opt] == $val) {
return ' checked="checked"'; return ' checked="checked"';
} }
@@ -213,8 +213,8 @@ function PMA_pluginGetOneOption($section, $plugin_name, $id, &$opt)
$ret .= '<input type="text" name="' . $plugin_name . '_' . $opt['name'] . '"' $ret .= '<input type="text" name="' . $plugin_name . '_' . $opt['name'] . '"'
. ' value="' . PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']) . '"' . ' value="' . PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']) . '"'
. ' id="text_' . $plugin_name . '_' . $opt['name'] . '"' . ' id="text_' . $plugin_name . '_' . $opt['name'] . '"'
. (isset($opt['size']) ? ' size="' . $opt['size'] . '"' : '' ) . (isset($opt['size']) ? ' size="' . $opt['size'] . '"' : '')
. (isset($opt['len']) ? ' maxlength="' . $opt['len'] . '"' : '' ) . ' />'; . (isset($opt['len']) ? ' maxlength="' . $opt['len'] . '"' : '') . ' />';
$ret .= '</div>' . "\n"; $ret .= '</div>' . "\n";
} elseif ($opt['type'] == 'message_only') { } elseif ($opt['type'] == 'message_only') {
$ret .= '<div class="formelementrow">' . "\n"; $ret .= '<div class="formelementrow">' . "\n";

View File

@@ -81,8 +81,8 @@ $tabs['import']['icon'] = 'b_import.png';
$tabs['import']['link'] = 'server_import.php'; $tabs['import']['link'] = 'server_import.php';
$tabs['import']['text'] = $strImport; $tabs['import']['text'] = $strImport;
echo PMA_getTabs( $tabs ); echo PMA_getTabs($tabs);
unset( $tabs ); unset($tabs);
/** /**

View File

@@ -151,7 +151,7 @@ function PMA_sqlQueryForm($query = true, $display_tab = false, $delimiter = ';')
// Bookmark Support // Bookmark Support
if ($display_tab === 'full' || $display_tab === 'history') { if ($display_tab === 'full' || $display_tab === 'history') {
if (! empty( $GLOBALS['cfg']['Bookmark']) if (! empty($GLOBALS['cfg']['Bookmark'])
&& $GLOBALS['cfg']['Bookmark']['db'] && $GLOBALS['cfg']['Bookmark']['db']
&& $GLOBALS['cfg']['Bookmark']['table']) { && $GLOBALS['cfg']['Bookmark']['table']) {
PMA_sqlQueryFormBookmark(); PMA_sqlQueryFormBookmark();
@@ -200,7 +200,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
// enable auto select text in textarea // enable auto select text in textarea
if ($GLOBALS['cfg']['TextareaAutoSelect']) { if ($GLOBALS['cfg']['TextareaAutoSelect']) {
$auto_sel = ' onfocus="selectContent( this, sql_box_locked, true )"'; $auto_sel = ' onfocus="selectContent(this, sql_box_locked, true)"';
} else { } else {
$auto_sel = ''; $auto_sel = '';
} }
@@ -272,7 +272,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
str_replace('%d', PMA_backquote($db), str_replace('%d', PMA_backquote($db),
str_replace('%t', PMA_backquote($table), str_replace('%t', PMA_backquote($table),
str_replace('%f', str_replace('%f',
implode(', ', $field_names ), implode(', ', $field_names),
$GLOBALS['cfg']['DefaultQueryTable']))); $GLOBALS['cfg']['DefaultQueryTable'])));
unset($field_names); unset($field_names);
} }
@@ -310,11 +310,11 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
if (isset($field['Field']) && strlen($field['Field']) && isset($field['Comment'])) { if (isset($field['Field']) && strlen($field['Field']) && isset($field['Comment'])) {
echo ' title="' . htmlspecialchars($field['Comment']) . '"'; echo ' title="' . htmlspecialchars($field['Comment']) . '"';
} }
echo '>' . htmlspecialchars( $field['Field'] ) . '</option>' . "\n"; echo '>' . htmlspecialchars($field['Field']) . '</option>' . "\n";
} }
echo '</select>' . "\n" echo '</select>' . "\n"
.'<div id="tablefieldinsertbuttoncontainer">' . "\n"; .'<div id="tablefieldinsertbuttoncontainer">' . "\n";
if ( $GLOBALS['cfg']['PropertiesIconic'] ) { if ($GLOBALS['cfg']['PropertiesIconic']) {
echo '<input type="button" name="insert" value="&lt;&lt;"' echo '<input type="button" name="insert" value="&lt;&lt;"'
.' onclick="insertValueQuery()"' .' onclick="insertValueQuery()"'
.' title="' . $GLOBALS['strInsert'] . '" />' . "\n"; .' title="' . $GLOBALS['strInsert'] . '" />' . "\n";
@@ -414,7 +414,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
*/ */
function PMA_sqlQueryFormBookmark() function PMA_sqlQueryFormBookmark()
{ {
$bookmark_list = PMA_listBookmarks($GLOBALS['db'], $GLOBALS['cfg']['Bookmark'] ); $bookmark_list = PMA_listBookmarks($GLOBALS['db'], $GLOBALS['cfg']['Bookmark']);
if (! $bookmark_list || count($bookmark_list) < 1) { if (! $bookmark_list || count($bookmark_list) < 1) {
return; return;
} }
@@ -540,9 +540,9 @@ function PMA_sqlQueryFormUpload(){
echo '<fieldset id="" class="tblFooters">'; echo '<fieldset id="" class="tblFooters">';
if ( PMA_MYSQL_INT_VERSION < 40100 if (PMA_MYSQL_INT_VERSION < 40100
&& $GLOBALS['cfg']['AllowAnywhereRecoding'] && $GLOBALS['cfg']['AllowAnywhereRecoding']
&& $GLOBALS['allow_recoding'] ) { && $GLOBALS['allow_recoding']) {
echo $GLOBALS['strCharsetOfFile'] . "\n" echo $GLOBALS['strCharsetOfFile'] . "\n"
. '<select name="charset_of_file" size="1">' . "\n"; . '<select name="charset_of_file" size="1">' . "\n";
foreach ($GLOBALS['cfg']['AvailableCharsets'] as $temp_charset) { foreach ($GLOBALS['cfg']['AvailableCharsets'] as $temp_charset) {
@@ -563,7 +563,7 @@ function PMA_sqlQueryFormUpload(){
echo '<div class="clearfloat"></div>' . "\n"; echo '<div class="clearfloat"></div>' . "\n";
echo '</fieldset>'; echo '</fieldset>';
foreach ( $errors as $error => $message ) { foreach ($errors as $error => $message) {
echo '<div>' . $error . '</div>'; echo '<div>' . $error . '</div>';
echo '<div>' . $message . '</div>'; echo '<div>' . $message . '</div>';
} }

View File

@@ -1253,8 +1253,8 @@ $PMA_SQPdata_column_type_cnt = 54;
/* /*
* check counts * check counts
foreach ( $GLOBALS as $n => $a ) { foreach ($GLOBALS as $n => $a) {
echo is_array( $a ) ? $n . ': ' . count( $a ) . '<br />' : ''; echo is_array($a) ? $n . ': ' . count($a) . '<br />' : '';
} }
*/ */
?> ?>

View File

@@ -34,7 +34,7 @@
/** /**
* Minimum inclusion? (i.e. for the stylesheet builder) * Minimum inclusion? (i.e. for the stylesheet builder)
*/ */
if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { if (! defined('PMA_MINIMUM_COMMON')) {
/** /**
* Include the string library as we use it heavily * Include the string library as we use it heavily
*/ */
@@ -588,7 +588,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
if (($first == ',') || ($first == ';') || ($first == '.') || ($first == '*')) { if (($first == ',') || ($first == ';') || ($first == '.') || ($first == '*')) {
$count2 = $count1 + 1; $count2 = $count1 + 1;
$punct_data = $first; $punct_data = $first;
} elseif (($last2 == '/*') || (($last2 == '--') && ($count2 == $len || PMA_substr($sql, $count2, 1) <= ' ') )) { } elseif (($last2 == '/*') || (($last2 == '--') && ($count2 == $len || PMA_substr($sql, $count2, 1) <= ' '))) {
$count2 -= 2; $count2 -= 2;
$punct_data = PMA_substr($sql, $count1, $count2 - $count1); $punct_data = PMA_substr($sql, $count1, $count2 - $count1);
} elseif (($last == '-') || ($last == '+') || ($last == '!')) { } elseif (($last == '-') || ($last == '+') || ($last == '!')) {
@@ -829,7 +829,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
// so we track wether we are in the EXTRACT() // so we track wether we are in the EXTRACT()
$in_extract = FALSE; $in_extract = FALSE;
// for GROUP_CONCAT( ... ) // for GROUP_CONCAT(...)
$in_group_concat = FALSE; $in_group_concat = FALSE;
/* Description of analyzer results by lem9 /* Description of analyzer results by lem9
@@ -1078,7 +1078,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
$previous_was_identifier = FALSE; $previous_was_identifier = FALSE;
$current_select_expr = -1; $current_select_expr = -1;
$seen_end_of_table_ref = FALSE; $seen_end_of_table_ref = FALSE;
} // end if ( data == SELECT) } // end if (data == SELECT)
if ($upper_data =='FROM' && !$in_extract) { if ($upper_data =='FROM' && !$in_extract) {
$current_table_ref = -1; $current_table_ref = -1;
@@ -1148,7 +1148,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
} // end if ($save_table_ref &&!$seen_end_of_table_ref) } // end if ($save_table_ref &&!$seen_end_of_table_ref)
} // end if (!$seen_from) } // end if (!$seen_from)
} // end if (querytype SELECT) } // end if (querytype SELECT)
} // end if ( quote_backtick or double quote or alpha_identifier) } // end if (quote_backtick or double quote or alpha_identifier)
// =================================== // ===================================
if ($arr[$i]['type'] == 'punct_qualifier') { if ($arr[$i]['type'] == 'punct_qualifier') {
@@ -1172,9 +1172,8 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
// the "*" is not saved // the "*" is not saved
if (isset($chain) && !$seen_end_of_table_ref if (isset($chain) && !$seen_end_of_table_ref
&& ( (!$seen_from && ((!$seen_from && $arr[$i]['type'] == 'punct_listsep')
&& $arr[$i]['type'] == 'punct_listsep') || ($arr[$i]['type'] == 'alpha_reservedWord' && $upper_data == 'FROM'))) {
|| ($arr[$i]['type'] == 'alpha_reservedWord' && $upper_data == 'FROM')) ) {
$size_chain = count($chain); $size_chain = count($chain);
$current_select_expr++; $current_select_expr++;
$subresult['select_expr'][$current_select_expr] = array( $subresult['select_expr'][$current_select_expr] = array(
@@ -1241,7 +1240,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
&& ($arr[$i]['type'] == 'punct_listsep' && ($arr[$i]['type'] == 'punct_listsep'
|| ($arr[$i]['type'] == 'alpha_reservedWord' && $upper_data!="AS") || ($arr[$i]['type'] == 'alpha_reservedWord' && $upper_data!="AS")
|| $seen_end_of_table_ref || $seen_end_of_table_ref
|| $i==$size-1 )) { || $i==$size-1)) {
$size_chain = count($chain); $size_chain = count($chain);
$current_table_ref++; $current_table_ref++;
@@ -1762,7 +1761,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
// (we got a bug report about not being able to use // (we got a bug report about not being able to use
// 'no' as an identifier) // 'no' as an identifier)
|| ($arr[$i+2]['type'] == 'alpha_identifier' || ($arr[$i+2]['type'] == 'alpha_identifier'
&& strtoupper($arr[$i+2]['data'])=='NO') ) && strtoupper($arr[$i+2]['data'])=='NO'))
) { ) {
$third_upper_data = strtoupper($arr[$i+2]['data']); $third_upper_data = strtoupper($arr[$i+2]['data']);
if ($third_upper_data == 'CASCADE' if ($third_upper_data == 'CASCADE'
@@ -2247,7 +2246,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
// the alpha_identifier exception is there to // the alpha_identifier exception is there to
// catch cases like // catch cases like
// GRANT SELECT ON mydb.mytable TO myuser@localhost // GRANT SELECT ON mydb.mytable TO myuser@localhost
// (else, we get mydb.mytableTO ) // (else, we get mydb.mytableTO)
// //
// the quote_single exception is there to // the quote_single exception is there to
// catch cases like // catch cases like
@@ -2427,7 +2426,7 @@ function PMA_SQP_buildCssData()
return $css_string; return $css_string;
} // end of the "PMA_SQP_buildCssData()" function } // end of the "PMA_SQP_buildCssData()" function
if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { if (! defined('PMA_MINIMUM_COMMON')) {
/** /**
* Gets SQL queries with no format * Gets SQL queries with no format
* *

View File

@@ -100,7 +100,7 @@ if (!function_exists('class_exists') || !class_exists('SOAP_Client')) {
$connection_technology, $connection_technology_version, $connection_technology, $connection_technology_version,
$interactive) $interactive)
{ {
$use_array = array( "a_userName" => $username, "a_password" => $password, "a_callingProgram" => $calling_program, "a_callingProgramVersion" => $calling_program_version, "a_targetDbms" => $target_dbms, "a_targetDbmsVersion" => $target_dbms_version, "a_connectionTechnology" => $connection_technology, "a_connectionTechnologyVersion" => $connection_technology_version, "a_interactive" => $interactive); $use_array = array("a_userName" => $username, "a_password" => $password, "a_callingProgram" => $calling_program, "a_callingProgramVersion" => $calling_program_version, "a_targetDbms" => $target_dbms, "a_targetDbmsVersion" => $target_dbms_version, "a_connectionTechnology" => $connection_technology, "a_connectionTechnologyVersion" => $connection_technology_version, "a_interactive" => $interactive);
$ret = $obj->call("openSession", $use_array); $ret = $obj->call("openSession", $use_array);
// This is the old version that needed the overload extension // This is the old version that needed the overload extension

View File

@@ -82,7 +82,7 @@ function PMA_generateEnginesDropdown($name = 'engine', $id = null,
$offerUnavailableEngines = false, $selected = null, $indent = 0) $offerUnavailableEngines = false, $selected = null, $indent = 0)
{ {
$selected = strtolower($selected); $selected = strtolower($selected);
$spaces = str_repeat( ' ', $indent ); $spaces = str_repeat(' ', $indent);
$output = $spaces . '<select name="' . $name . '"' $output = $spaces . '<select name="' . $name . '"'
. (empty($id) ? '' : ' id="' . $id . '"') . '>' . "\n"; . (empty($id) ? '' : ' id="' . $id . '"') . '>' . "\n";

View File

@@ -14,7 +14,7 @@ require_once './libraries/bookmark.lib.php';
// Check parameters // Check parameters
PMA_checkParameters(array('db', 'table')); PMA_checkParameters(array('db', 'table'));
if ( PMA_MYSQL_INT_VERSION >= 50002 && $db === 'information_schema' ) { if (PMA_MYSQL_INT_VERSION >= 50002 && $db === 'information_schema') {
$db_is_information_schema = true; $db_is_information_schema = true;
} else { } else {
$db_is_information_schema = false; $db_is_information_schema = false;
@@ -32,8 +32,8 @@ $url_params['table'] = $table;
/** /**
* Defines the urls to return to in case of error in a sql statement * Defines the urls to return to in case of error in a sql statement
*/ */
$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url( array( 'db' => $db, ) ); $err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url(array('db' => $db,));
$err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url( $url_params ); $err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params);
/** /**

View File

@@ -145,7 +145,7 @@ function PMA_extract_indexes(&$ret_keys, &$indexes, &$indexes_info, &$indexes_da
$prev_index = ''; $prev_index = '';
foreach ($ret_keys as $row) { foreach ($ret_keys as $row) {
if ($row['Key_name'] != $prev_index ){ if ($row['Key_name'] != $prev_index){
$indexes[] = $row['Key_name']; $indexes[] = $row['Key_name'];
$prev_index = $row['Key_name']; $prev_index = $row['Key_name'];
} }
@@ -198,7 +198,7 @@ function PMA_show_indexes($table, &$indexes, &$indexes_info, &$indexes_data,
if ($display_html) { if ($display_html) {
$row_span = ' rowspan="' . count($indexes_info[$index_name]['Sequences']) . '" '; $row_span = ' rowspan="' . count($indexes_info[$index_name]['Sequences']) . '" ';
echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n"; echo ' <tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n";
echo ' <th ' . $row_span . '>' . "\n" echo ' <th ' . $row_span . '>' . "\n"
. ' ' . htmlspecialchars($index_name) . "\n" . ' ' . htmlspecialchars($index_name) . "\n"
. ' </th>' . "\n"; . ' </th>' . "\n";
@@ -267,11 +267,11 @@ function PMA_show_indexes($table, &$indexes, &$indexes_info, &$indexes_data,
if ($display_html) { if ($display_html) {
if ($row_no > 0) { if ($row_no > 0) {
echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n"; echo ' <tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n";
} }
if ( isset($indexes_data[$index_name][$seq_index]['Sub_part']) if (isset($indexes_data[$index_name][$seq_index]['Sub_part'])
&& strlen($indexes_data[$index_name][$seq_index]['Sub_part']) ) { && strlen($indexes_data[$index_name][$seq_index]['Sub_part'])) {
echo ' <td>' . $col_name . '</td>' . "\n"; echo ' <td>' . $col_name . '</td>' . "\n";
echo ' <td align="right">' . "\n" echo ' <td align="right">' . "\n"
. ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n" . ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n"

View File

@@ -51,15 +51,15 @@ $table_info_result = PMA_DBI_query(
if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) { if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) {
$showtable = PMA_DBI_fetch_assoc($table_info_result); $showtable = PMA_DBI_fetch_assoc($table_info_result);
PMA_DBI_free_result($table_info_result); PMA_DBI_free_result($table_info_result);
unset( $table_info_result ); unset($table_info_result);
if (!isset($showtable['Type']) && isset($showtable['Engine'])) { if (!isset($showtable['Type']) && isset($showtable['Engine'])) {
$showtable['Type'] =& $showtable['Engine']; $showtable['Type'] =& $showtable['Engine'];
} }
// MySQL < 5.0.13 returns "view", >= 5.0.13 returns "VIEW" // MySQL < 5.0.13 returns "view", >= 5.0.13 returns "VIEW"
if ( PMA_MYSQL_INT_VERSION >= 50000 && !isset($showtable['Type']) if (PMA_MYSQL_INT_VERSION >= 50000 && !isset($showtable['Type'])
&& isset($showtable['Comment']) && isset($showtable['Comment'])
&& strtoupper($showtable['Comment']) == 'VIEW' ) { && strtoupper($showtable['Comment']) == 'VIEW') {
$tbl_is_view = true; $tbl_is_view = true;
$tbl_type = $GLOBALS['strView']; $tbl_type = $GLOBALS['strView'];
$show_comment = null; $show_comment = null;
@@ -82,9 +82,9 @@ if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) {
? '' ? ''
: $showtable['Collation']; : $showtable['Collation'];
if ( null === $showtable['Rows'] ) { if (null === $showtable['Rows']) {
$showtable['Rows'] = PMA_Table::countRecords( $GLOBALS['db'], $showtable['Rows'] = PMA_Table::countRecords($GLOBALS['db'],
$showtable['Name'], true, true ); $showtable['Name'], true, true);
} }
$table_info_num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0; $table_info_num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0;
$auto_increment = isset($showtable['Auto_increment']) $auto_increment = isset($showtable['Auto_increment'])
@@ -98,14 +98,14 @@ if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) {
// export create options by its name as variables into gloabel namespace // export create options by its name as variables into gloabel namespace
// f.e. pack_keys=1 becomes available as $pack_keys with value of '1' // f.e. pack_keys=1 becomes available as $pack_keys with value of '1'
unset($pack_keys); unset($pack_keys);
foreach ( $create_options as $each_create_option ) { foreach ($create_options as $each_create_option) {
$each_create_option = explode('=', $each_create_option); $each_create_option = explode('=', $each_create_option);
if ( isset( $each_create_option[1] ) ) { if (isset($each_create_option[1])) {
$$each_create_option[0] = $each_create_option[1]; $$each_create_option[0] = $each_create_option[1];
} }
} }
// we need explicit DEFAULT value here (different from '0') // we need explicit DEFAULT value here (different from '0')
$pack_keys = (!isset($pack_keys) || strlen($pack_keys) == 0) ? 'DEFAULT' : $pack_keys; $pack_keys = (!isset($pack_keys) || strlen($pack_keys) == 0) ? 'DEFAULT' : $pack_keys;
unset( $create_options, $each_create_option ); unset($create_options, $each_create_option);
} // end if } // end if
?> ?>

View File

@@ -31,8 +31,8 @@ $url_params['table'] = $table;
/** /**
* Defines the urls to return to in case of error in a sql statement * Defines the urls to return to in case of error in a sql statement
*/ */
$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url( array( 'db' => $db, ) ); $err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url(array('db' => $db,));
$err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url( $url_params ); $err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params);
/** /**
* Displays headers * Displays headers
@@ -62,7 +62,7 @@ $tabs['search']['icon'] = 'b_search.png';
$tabs['search']['text'] = $strSearch; $tabs['search']['text'] = $strSearch;
$tabs['search']['link'] = 'tbl_select.php'; $tabs['search']['link'] = 'tbl_select.php';
if ( ! (isset($db_is_information_schema) && $db_is_information_schema) ) { if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
$tabs['insert']['icon'] = 'b_insrow.png'; $tabs['insert']['icon'] = 'b_insrow.png';
$tabs['insert']['link'] = 'tbl_change.php'; $tabs['insert']['link'] = 'tbl_change.php';
$tabs['insert']['text'] = $strInsert; $tabs['insert']['text'] = $strInsert;
@@ -77,7 +77,7 @@ $tabs['export']['text'] = $strExport;
* Don't display "Import", "Operations" and "Empty" * Don't display "Import", "Operations" and "Empty"
* for views and information_schema * for views and information_schema
*/ */
if ( ! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema )) { if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
$tabs['import']['icon'] = 'b_tblimport.png'; $tabs['import']['icon'] = 'b_tblimport.png';
$tabs['import']['link'] = 'tbl_import.php'; $tabs['import']['link'] = 'tbl_import.php';
$tabs['import']['text'] = $strImport; $tabs['import']['text'] = $strImport;
@@ -105,7 +105,7 @@ if ( ! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information
/** /**
* no drop in information_schema * no drop in information_schema
*/ */
if ( ! (isset($db_is_information_schema) && $db_is_information_schema) ) { if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
$tabs['drop']['icon'] = 'b_deltbl.png'; $tabs['drop']['icon'] = 'b_deltbl.png';
$tabs['drop']['link'] = 'sql.php'; $tabs['drop']['link'] = 'sql.php';
$tabs['drop']['text'] = $strDrop; $tabs['drop']['text'] = $strDrop;
@@ -125,8 +125,8 @@ if ($table_info_num_rows == 0 && !$tbl_is_view) {
$tabs['search']['warning'] = $strTableIsEmpty; $tabs['search']['warning'] = $strTableIsEmpty;
} }
echo PMA_getTabs( $tabs ); echo PMA_getTabs($tabs);
unset( $tabs ); unset($tabs);
/** /**
* Displays a message * Displays a message

View File

@@ -179,7 +179,7 @@ if (isset($field_fulltext) && is_array($field_fulltext)) {
} }
} }
for ( $i = 0 ; $i <= $num_fields; $i++ ) { for ($i = 0 ; $i <= $num_fields; $i++) {
$submit_null = FALSE; $submit_null = FALSE;
if (isset($regenerate) && $regenerate == TRUE) { if (isset($regenerate) && $regenerate == TRUE) {
// An error happened with previous inputs, so we will restore the data // An error happened with previous inputs, so we will restore the data
@@ -377,7 +377,7 @@ for ( $i = 0 ; $i <= $num_fields; $i++ ) {
$attribute = 'ON UPDATE CURRENT_TIMESTAMP'; $attribute = 'ON UPDATE CURRENT_TIMESTAMP';
} }
if ((isset($row['Field']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp'])) if ((isset($row['Field']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp']))
|| (isset($submit_default_current_timestamp) && $submit_default_current_timestamp) ) { || (isset($submit_default_current_timestamp) && $submit_default_current_timestamp)) {
$default_current_timestamp = TRUE; $default_current_timestamp = TRUE;
} else { } else {
$default_current_timestamp = FALSE; $default_current_timestamp = FALSE;
@@ -559,26 +559,26 @@ for ( $i = 0 ; $i <= $num_fields; $i++ ) {
} }
} // end for } // end for
if ( is_array( $content_cells ) && is_array( $header_cells ) ) { if (is_array($content_cells) && is_array($header_cells)) {
// last row is for javascript insert // last row is for javascript insert
$empty_row = array_pop( $content_cells ); $empty_row = array_pop($content_cells);
echo '<table id="table_columns">'; echo '<table id="table_columns">';
if ( $display_type == 'horizontal' ) { if ($display_type == 'horizontal') {
?> ?>
<tr> <tr>
<?php foreach ( $header_cells as $header_val ) { ?> <?php foreach ($header_cells as $header_val) { ?>
<th><?php echo $header_val; ?></th> <th><?php echo $header_val; ?></th>
<?php } ?> <?php } ?>
</tr> </tr>
<?php <?php
$odd_row = true; $odd_row = true;
foreach ( $content_cells as $content_row ) { foreach ($content_cells as $content_row) {
echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . ' noclick">'; echo '<tr class="' . ($odd_row ? 'odd' : 'even') . ' noclick">';
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
if ( is_array( $content_row ) ) { if (is_array($content_row)) {
foreach ($content_row as $content_row_val) { foreach ($content_row as $content_row_val) {
?> ?>
<td align="center"><?php echo $content_row_val; ?></td> <td align="center"><?php echo $content_row_val; ?></td>
@@ -590,14 +590,14 @@ if ( is_array( $content_cells ) && is_array( $header_cells ) ) {
} else { } else {
$i = 0; $i = 0;
$odd_row = true; $odd_row = true;
foreach ( $header_cells as $header_val ) { foreach ($header_cells as $header_val) {
echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . ' noclick">'; echo '<tr class="' . ($odd_row ? 'odd' : 'even') . ' noclick">';
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
?> ?>
<th><?php echo $header_val; ?></th> <th><?php echo $header_val; ?></th>
<?php <?php
foreach ( $content_cells as $content_cell ) { foreach ($content_cells as $content_cell) {
if ( isset( $content_cell[$i] ) && $content_cell[$i] != '' ) { if (isset($content_cell[$i]) && $content_cell[$i] != '') {
?> ?>
<td><?php echo $content_cell[$i]; ?></td> <td><?php echo $content_cell[$i]; ?></td>
<?php <?php
@@ -617,9 +617,9 @@ if ( is_array( $content_cells ) && is_array( $header_cells ) ) {
* needs to be finished * needs to be finished
* *
* *
if ( $display_type == 'horizontal' ) { if ($display_type == 'horizontal') {
$new_field = ''; $new_field = '';
foreach ( $empty_row as $content_row_val ) { foreach ($empty_row as $content_row_val) {
$new_field .= '<td align="center">' . $content_row_val . '</td>'; $new_field .= '<td align="center">' . $content_row_val . '</td>';
} }
?> ?>
@@ -630,10 +630,10 @@ var odd_row = <?php echo $odd_row; ?>;
function addField() { function addField() {
var new_fields = document.getElementById('added_fields').value; var new_fields = document.getElementById('added_fields').value;
var new_field_container = document.getElementById('table_columns'); var new_field_container = document.getElementById('table_columns');
var new_field = '<?php echo preg_replace( '<27>\s+<2B>', ' ', preg_replace( '<27>\'<27>', '\\\'', $new_field ) ); ?>'; var new_field = '<?php echo preg_replace('<27>\s+<2B>', ' ', preg_replace('<27>\'<27>', '\\\'', $new_field)); ?>';
var i = 0; var i = 0;
for ( i = 0; i < new_fields; i++ ) { for (i = 0; i < new_fields; i++) {
if ( odd_row ) { if (odd_row) {
new_field_container.innerHTML += '<tr class="odd">' + new_field + '</tr>'; new_field_container.innerHTML += '<tr class="odd">' + new_field + '</tr>';
} else { } else {
new_field_container.innerHTML += '<tr class="even">' + new_field + '</tr>'; new_field_container.innerHTML += '<tr class="even">' + new_field + '</tr>';
@@ -658,7 +658,7 @@ if ($action == 'tbl_create.php') {
<th><?php echo $strStorageEngine; ?>:&nbsp;<?php echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?> <th><?php echo $strStorageEngine; ?>:&nbsp;<?php echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?>
</th> </th>
<?php <?php
if ( PMA_MYSQL_INT_VERSION >= 40100 ) { if (PMA_MYSQL_INT_VERSION >= 40100) {
echo ' <td width="25">&nbsp;</td>' . "\n" echo ' <td width="25">&nbsp;</td>' . "\n"
. ' <th>' . $strCollation . ':&nbsp;</th>' . "\n"; . ' <th>' . $strCollation . ':&nbsp;</th>' . "\n";
} }
@@ -673,7 +673,7 @@ if ($action == 'tbl_create.php') {
<?php echo PMA_generateEnginesDropdown('tbl_type', null, FALSE, (isset($GLOBALS['tbl_type']) ? $GLOBALS['tbl_type'] : null), 3); ?> <?php echo PMA_generateEnginesDropdown('tbl_type', null, FALSE, (isset($GLOBALS['tbl_type']) ? $GLOBALS['tbl_type'] : null), 3); ?>
</td> </td>
<?php <?php
if ( PMA_MYSQL_INT_VERSION >= 40100 ) { if (PMA_MYSQL_INT_VERSION >= 40100) {
echo ' <td width="25">&nbsp;</td>' . "\n" echo ' <td width="25">&nbsp;</td>' . "\n"
. ' <td>' . "\n" . ' <td>' . "\n"
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', null, (isset($tbl_collation) ? $tbl_collation : null), FALSE, 3) . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', null, (isset($tbl_collation) ? $tbl_collation : null), FALSE, 3)
@@ -691,10 +691,10 @@ if ($action == 'tbl_create.php') {
<input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" onclick="return checkTableEditForm(this.form, <?php echo $num_fields; ?>)" /> <input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" onclick="return checkTableEditForm(this.form, <?php echo $num_fields; ?>)" />
<?php if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') { ?> <?php if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') { ?>
<?php echo $GLOBALS['strOr']; ?> <?php echo $GLOBALS['strOr']; ?>
<?php echo sprintf( $strAddFields, '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />' ); ?> <?php echo sprintf($strAddFields, '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?>
<input type="submit" name="submit_num_fields" <input type="submit" name="submit_num_fields"
value="<?php echo $GLOBALS['strGo']; ?>" value="<?php echo $GLOBALS['strGo']; ?>"
<?php /* onclick="if ( addField() ) return false;" */ ?> <?php /* onclick="if (addField()) return false;" */ ?>
onclick="return checkFormElementInRange(this.form, 'added_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']); ?>', 1)" onclick="return checkFormElementInRange(this.form, 'added_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']); ?>', 1)"
/> />
<?php } ?> <?php } ?>
@@ -709,10 +709,10 @@ if ($action == 'tbl_create.php') {
if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
echo '<p> <a name="footnoote_mime"><sup>3</sup></a> ' . $strMIME_transformation_options_note . '</p>'; echo '<p> <a name="footnoote_mime"><sup>3</sup></a> ' . $strMIME_transformation_options_note . '</p>';
echo '<p> '; echo '<p> ';
printf( $strMIME_transformation_note, printf($strMIME_transformation_note,
'<a href="transformation_overview.php?' '<a href="transformation_overview.php?'
. PMA_generate_common_url($db, $table) . '" target="_blank">', . PMA_generate_common_url($db, $table) . '" target="_blank">',
'</a>' ); '</a>');
echo '</p>'; echo '</p>';
} }
?> ?>

View File

@@ -145,14 +145,14 @@ class zipfile
$cdrec .= pack('V', $crc); // crc32 $cdrec .= pack('V', $crc); // crc32
$cdrec .= pack('V', $c_len); // compressed filesize $cdrec .= pack('V', $c_len); // compressed filesize
$cdrec .= pack('V', $unc_len); // uncompressed filesize $cdrec .= pack('V', $unc_len); // uncompressed filesize
$cdrec .= pack('v', strlen($name) ); // length of filename $cdrec .= pack('v', strlen($name)); // length of filename
$cdrec .= pack('v', 0 ); // extra field length $cdrec .= pack('v', 0); // extra field length
$cdrec .= pack('v', 0 ); // file comment length $cdrec .= pack('v', 0); // file comment length
$cdrec .= pack('v', 0 ); // disk number start $cdrec .= pack('v', 0); // disk number start
$cdrec .= pack('v', 0 ); // internal file attributes $cdrec .= pack('v', 0); // internal file attributes
$cdrec .= pack('V', 32 ); // external file attributes - 'archive' bit set $cdrec .= pack('V', 32); // external file attributes - 'archive' bit set
$cdrec .= pack('V', $this -> old_offset ); // relative offset of local header $cdrec .= pack('V', $this -> old_offset); // relative offset of local header
$this -> old_offset += strlen($fr); $this -> old_offset += strlen($fr);
$cdrec .= $name; $cdrec .= $name;

View File

@@ -356,7 +356,7 @@ foreach ($array_sh_page AS $key => $temp_sh_page) {
$reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n"; $reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n";
$local_query = 'SHOW FIELDS FROM ' $local_query = 'SHOW FIELDS FROM '
. PMA_backquote($temp_sh_page['table_name'] ) . PMA_backquote($temp_sh_page['table_name'])
. ' FROM ' . PMA_backquote($db); . ' FROM ' . PMA_backquote($db);
$fields_rs = PMA_DBI_query($local_query); $fields_rs = PMA_DBI_query($local_query);
unset($local_query); unset($local_query);

View File

@@ -8,14 +8,14 @@
/** /**
* Gets core libraries and defines some variables * Gets core libraries and defines some variables
*/ */
define( 'PMA_MINIMUM_COMMON', true ); define('PMA_MINIMUM_COMMON', true);
require_once './libraries/common.inc.php'; require_once './libraries/common.inc.php';
/** /**
* Displays PHP information * Displays PHP information
*/ */
if ( $GLOBALS['cfg']['ShowPhpInfo'] ) { if ($GLOBALS['cfg']['ShowPhpInfo']) {
phpinfo(); phpinfo();
} }
?> ?>

View File

@@ -15,7 +15,7 @@ require_once './libraries/sqlparser.lib.php';
// MSIE 6 (at least some unpatched versions) has problems loading CSS // MSIE 6 (at least some unpatched versions) has problems loading CSS
// when zlib_compression is on // when zlib_compression is on
if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER == '6' if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER == '6'
&& (ini_get('zlib.output_compression')) ) { && (ini_get('zlib.output_compression'))) {
ini_set('zlib.output_compression', 'Off'); ini_set('zlib.output_compression', 'Off');
} }

View File

@@ -131,7 +131,7 @@ function get_script_contr()
while ($val = @PMA_DBI_fetch_row($alltab_rs)) { while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
$row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'internal'); $row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'internal');
//echo "<br> internal ".$GLOBALS['db']." - ".$val[0]." - "; //echo "<br> internal ".$GLOBALS['db']." - ".$val[0]." - ";
//print_r($row ); //print_r($row);
if ($row !== false) { if ($row !== false) {
foreach ($row as $field => $value) { foreach ($row as $field => $value) {
$con['C_NAME'][$i] = ''; $con['C_NAME'][$i] = '';
@@ -144,7 +144,7 @@ function get_script_contr()
} }
$row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'innodb'); $row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'innodb');
//echo "<br> INNO "; //echo "<br> INNO ";
//print_r($row ); //print_r($row);
if ($row !== false) { if ($row !== false) {
foreach ($row as $field => $value) { foreach ($row as $field => $value) {
$con['C_NAME'][$i] = ''; $con['C_NAME'][$i] = '';

View File

@@ -44,7 +44,7 @@ echo '
var strLang = Array(); var strLang = Array();
strLang["strModifications"] = "' . PMA_escapeJsString($strModifications) . '"; strLang["strModifications"] = "' . PMA_escapeJsString($strModifications) . '";
strLang["strRelationDeleted"] = "' . PMA_escapeJsString($strRelationDeleted) . '"; strLang["strRelationDeleted"] = "' . PMA_escapeJsString($strRelationDeleted) . '";
strLang["strInnoDBRelationAdded"] = "' . PMA_escapeJsString($strInnoDBRelationAdded ). '"; strLang["strInnoDBRelationAdded"] = "' . PMA_escapeJsString($strInnoDBRelationAdded). '";
strLang["strGeneralRelationFeat:strDisabled"] = "' . PMA_escapeJsString($strGeneralRelationFeat . ' : ' . $strDisabled) . '"; strLang["strGeneralRelationFeat:strDisabled"] = "' . PMA_escapeJsString($strGeneralRelationFeat . ' : ' . $strDisabled) . '";
strLang["strInternalRelationAdded"] = "' . PMA_escapeJsString($strInternalRelationAdded) . '"; strLang["strInternalRelationAdded"] = "' . PMA_escapeJsString($strInternalRelationAdded) . '";
strLang["strErrorRelationAdded"] = "' . PMA_escapeJsString($strErrorRelationAdded) . '"; strLang["strErrorRelationAdded"] = "' . PMA_escapeJsString($strErrorRelationAdded) . '";

View File

@@ -10,7 +10,7 @@
* *
*/ */
include_once 'pmd_common.php'; include_once 'pmd_common.php';
if ( ! isset($scale)) { if (! isset($scale)) {
$no_die_save_pos = 1; $no_die_save_pos = 1;
include_once 'pmd_save_pos.php'; include_once 'pmd_save_pos.php';
} }

View File

@@ -82,7 +82,7 @@ if ($type_T1 == 'INNODB' and $type_T2 == 'INNODB') {
. '\'' . PMA_sqlAddslashes($T1) . '\',' . '\'' . PMA_sqlAddslashes($T1) . '\','
. '\'' . PMA_sqlAddslashes($F1) . '\')'; . '\'' . PMA_sqlAddslashes($F1) . '\')';
if (PMA_query_as_cu( $q , false, PMA_DBI_QUERY_STORE)) { if (PMA_query_as_cu($q , false, PMA_DBI_QUERY_STORE)) {
PMD_return(1, 'strInternalRelationAdded'); PMD_return(1, 'strInternalRelationAdded');
} else { } else {
PMD_return(0, 'strErrorRelationAdded'); PMD_return(0, 'strErrorRelationAdded');

View File

@@ -22,7 +22,7 @@ while ($tab_name = @PMA_DBI_fetch_row($alltab_rs)) {
} }
} }
if ( ! $seen_pmd_table) { if (! $seen_pmd_table) {
PMD_err_sav(); PMD_err_sav();
} }

View File

@@ -14,7 +14,7 @@
*/ */
// Grab phpMyAdmin version and PMA_dl function // Grab phpMyAdmin version and PMA_dl function
define( 'PMA_MINIMUM_COMMON', TRUE ); define('PMA_MINIMUM_COMMON', TRUE);
chdir('..'); chdir('..');
require_once './libraries/common.inc.php'; require_once './libraries/common.inc.php';
@@ -54,7 +54,7 @@ if ($eoltype == 'dos') {
$crlf = "\n"; $crlf = "\n";
} }
if (isset($_POST['configuration']) && $action != 'clear' ) { if (isset($_POST['configuration']) && $action != 'clear') {
// Grab previous configuration, if it should not be cleared // Grab previous configuration, if it should not be cleared
$configuration = unserialize($_POST['configuration']); $configuration = unserialize($_POST['configuration']);
} else { } else {
@@ -1229,17 +1229,17 @@ function get_server_selection($cfg) {
* @return mixed FALSE on failure, new config array on success * @return mixed FALSE on failure, new config array on success
*/ */
function load_config($config_file) { function load_config($config_file) {
if ( file_exists( $config_file ) ) { if (file_exists($config_file)) {
$success_apply_user_config = FALSE; $success_apply_user_config = FALSE;
$old_error_reporting = error_reporting( 0 ); $old_error_reporting = error_reporting(0);
if ( function_exists( 'file_get_contents' ) ) { if (function_exists('file_get_contents')) {
$success_apply_user_config = eval('?>' . trim(file_get_contents($config_file))); $success_apply_user_config = eval('?>' . trim(file_get_contents($config_file)));
} else { } else {
$success_apply_user_config = $success_apply_user_config =
eval('?>' . trim(implode("\n", file($config_file)))); eval('?>' . trim(implode("\n", file($config_file))));
} }
error_reporting( $old_error_reporting ); error_reporting($old_error_reporting);
unset( $old_error_reporting ); unset($old_error_reporting);
if ($success_apply_user_config === FALSE) { if ($success_apply_user_config === FALSE) {
message('error', 'Error while parsing configuration file!'); message('error', 'Error while parsing configuration file!');
} elseif (!isset($cfg) || count($cfg) == 0) { } elseif (!isset($cfg) || count($cfg) == 0) {
@@ -1360,7 +1360,7 @@ switch ($action) {
message('error', 'Empty signon URL while using signon authentication method!'); message('error', 'Empty signon URL while using signon authentication method!');
$err = TRUE; $err = TRUE;
} }
if ( isset($new_server['pmadb']) && strlen($new_server['pmadb'])) { if (isset($new_server['pmadb']) && strlen($new_server['pmadb'])) {
// Just use defaults, should be okay for most users // Just use defaults, should be okay for most users
$pmadb = array(); $pmadb = array();
$pmadb['bookmarktable'] = 'pma_bookmark'; $pmadb['bookmarktable'] = 'pma_bookmark';
@@ -1879,7 +1879,7 @@ switch ($action) {
break; break;
} }
$version_local = version_to_int( $PMA_Config_Setup->get('PMA_VERSION') ); $version_local = version_to_int($PMA_Config_Setup->get('PMA_VERSION'));
if ($version_local === FALSE) { if ($version_local === FALSE) {
message('error', 'Unparsable version string.'); message('error', 'Unparsable version string.');
break; break;
@@ -1907,7 +1907,7 @@ switch ($action) {
case '': case '':
message('notice', 'You want to configure phpMyAdmin using web interface. Please note that this only allows basic setup, please read <a href="../Documentation.html#config">documentation</a> to see full description of all configuration directives.', 'Welcome'); message('notice', 'You want to configure phpMyAdmin using web interface. Please note that this only allows basic setup, please read <a href="../Documentation.html#config">documentation</a> to see full description of all configuration directives.', 'Welcome');
if ( $PMA_Config_Setup->get( 'PMA_PHP_INT_VERSION' ) < 40100) { if ($PMA_Config_Setup->get('PMA_PHP_INT_VERSION') < 40100) {
message('warning', 'Please upgrade to PHP 4.1.0, it is required for phpMyAdmin.', 'Too old PHP'); message('warning', 'Please upgrade to PHP 4.1.0, it is required for phpMyAdmin.', 'Too old PHP');
} }
@@ -1994,9 +1994,9 @@ echo get_action('load', 'Load', '', !$fail_dir);
echo get_action('clear', 'Clear'); echo get_action('clear', 'Clear');
echo get_action('seteol', 'Change end of line', echo get_action('seteol', 'Change end of line',
'<select name="neweol">' . '<select name="neweol">' .
'<option value="unix" ' . ( $eoltype == 'unix' ? ' selected="selected"' : '' ) . '>UNIX/Linux (\\n)</option>' . '<option value="unix" ' . ($eoltype == 'unix' ? ' selected="selected"' : '') . '>UNIX/Linux (\\n)</option>' .
'<option value="dos" ' . ( $eoltype == 'dos' ? ' selected="selected"' : '' ) . '>DOS/Windows (\\r\\n)</option>' . '<option value="dos" ' . ($eoltype == 'dos' ? ' selected="selected"' : '') . '>DOS/Windows (\\r\\n)</option>' .
'<option value="mac" ' . ( $eoltype == 'mac' ? ' selected="selected"' : '' ) . '>Macintosh (\\r)</option>' . ' '<option value="mac" ' . ($eoltype == 'mac' ? ' selected="selected"' : '') . '>Macintosh (\\r)</option>' . '
</select>'); </select>');
echo '</fieldset>' . "\n\n"; echo '</fieldset>' . "\n\n";

View File

@@ -106,7 +106,7 @@ if (empty($_REQUEST['dontlimitchars'])) {
* Displays the sub-page heading * Displays the sub-page heading
*/ */
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '' ) . ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '')
. ' ' . $GLOBALS['strBinaryLog'] . "\n" . ' ' . $GLOBALS['strBinaryLog'] . "\n"
. '</h2>' . "\n"; . '</h2>' . "\n";

View File

@@ -8,8 +8,8 @@
/** /**
* requirements * requirements
*/ */
if ( ! defined( 'PMA_NO_VARIABLES_IMPORT' ) ) { if (! defined('PMA_NO_VARIABLES_IMPORT')) {
define( 'PMA_NO_VARIABLES_IMPORT', true ); define('PMA_NO_VARIABLES_IMPORT', true);
} }
require_once './libraries/common.inc.php'; require_once './libraries/common.inc.php';
@@ -85,7 +85,7 @@ foreach ($mysql_charsets as $current_charset) {
foreach ($mysql_collations[$current_charset] as $current_collation) { foreach ($mysql_collations[$current_charset] as $current_collation) {
$i++; $i++;
echo '<tr class="' echo '<tr class="'
. ( $odd_row ? 'odd' : 'even' ) . ($odd_row ? 'odd' : 'even')
. ($mysql_default_collations[$current_charset] == $current_collation . ($mysql_default_collations[$current_charset] == $current_collation
? ' marked' ? ' marked'
: '') : '')

View File

@@ -75,11 +75,11 @@ require './libraries/server_links.inc.php';
* Displays the sub-page heading * Displays the sub-page heading
*/ */
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ( $GLOBALS['cfg']['MainPageIconic'] . ($GLOBALS['cfg']['MainPageIconic']
? '<img class="icon" src="' . $pmaThemeImage . 's_db.png" width="16"' ? '<img class="icon" src="' . $pmaThemeImage . 's_db.png" width="16"'
.' height="16" alt="" />' .' height="16" alt="" />'
: '' ) : '')
. ( $dbstats ? $strDatabasesStats : $strDatabases ) . "\n" . ($dbstats ? $strDatabasesStats : $strDatabases) . "\n"
.'</h2>' . "\n"; .'</h2>' . "\n";
/** /**
@@ -224,9 +224,9 @@ if ($databases_count > 0) {
. ($sort_by == 'SCHEMA_NAME' ? ' <img class="icon" src="' . $pmaThemeImage . 's_' . $sort_order . '.png" width="11" height="9" alt="' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '" />' . "\n" : '') . ($sort_by == 'SCHEMA_NAME' ? ' <img class="icon" src="' . $pmaThemeImage . 's_' . $sort_order . '.png" width="11" height="9" alt="' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '" />' . "\n" : '')
. ' </a></th>' . "\n"; . ' </a></th>' . "\n";
$table_columns = 3; $table_columns = 3;
foreach ( $column_order as $stat_name => $stat ) { foreach ($column_order as $stat_name => $stat) {
if ( array_key_exists( $stat_name, $first_database ) ) { if (array_key_exists($stat_name, $first_database)) {
if ( $stat['format'] === 'byte' ) { if ($stat['format'] === 'byte') {
$table_columns += 2; $table_columns += 2;
$colspan = ' colspan="2"'; $colspan = ' colspan="2"';
} else { } else {
@@ -243,7 +243,7 @@ if ($databases_count > 0) {
} }
} }
if ($is_superuser) { if ($is_superuser) {
echo ' <th>' . ($cfg['PropertiesIconic'] ? '&nbsp;' : $strAction ) . "\n" echo ' <th>' . ($cfg['PropertiesIconic'] ? '&nbsp;' : $strAction) . "\n"
. ' </th>' . "\n"; . ' </th>' . "\n";
} }
echo '</tr>' . "\n" echo '</tr>' . "\n"
@@ -252,10 +252,10 @@ if ($databases_count > 0) {
$odd_row = true; $odd_row = true;
foreach ($databases as $current) { foreach ($databases as $current) {
echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n"; echo '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n";
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
if ( $is_superuser || $cfg['AllowUserDropDatabase'] ) { if ($is_superuser || $cfg['AllowUserDropDatabase']) {
echo ' <td class="tool">' . "\n"; echo ' <td class="tool">' . "\n";
if ($current['SCHEMA_NAME'] != 'mysql' && (PMA_MYSQL_INT_VERSION < 50002 || $current['SCHEMA_NAME'] != 'information_schema')) { if ($current['SCHEMA_NAME'] != 'mysql' && (PMA_MYSQL_INT_VERSION < 50002 || $current['SCHEMA_NAME'] != 'information_schema')) {
echo ' <input type="checkbox" name="selected_dbs[]" title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" value="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ' . (empty($checkall) ? '' : 'checked="checked" ') . '/>' . "\n"; echo ' <input type="checkbox" name="selected_dbs[]" title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" value="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ' . (empty($checkall) ? '' : 'checked="checked" ') . '/>' . "\n";
@@ -265,33 +265,33 @@ if ($databases_count > 0) {
echo ' </td>' . "\n"; echo ' </td>' . "\n";
} }
echo ' <td class="name">' . "\n" echo ' <td class="name">' . "\n"
. ' <a onclick="if ( window.parent.openDb(\'' . urlencode($current['SCHEMA_NAME']) . '\') ) return false;" href="index.php?' . $url_query . '&amp;db=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf($strJumpToDB, htmlspecialchars($current['SCHEMA_NAME'])) . '" target="_parent">' . "\n" . ' <a onclick="if (window.parent.openDb(\'' . urlencode($current['SCHEMA_NAME']) . '\')) return false;" href="index.php?' . $url_query . '&amp;db=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf($strJumpToDB, htmlspecialchars($current['SCHEMA_NAME'])) . '" target="_parent">' . "\n"
. ' ' . htmlspecialchars($current['SCHEMA_NAME']) . "\n" . ' ' . htmlspecialchars($current['SCHEMA_NAME']) . "\n"
. ' </a>' . "\n" . ' </a>' . "\n"
. ' </td>' . "\n"; . ' </td>' . "\n";
foreach ( $column_order as $stat_name => $stat ) { foreach ($column_order as $stat_name => $stat) {
if ( array_key_exists( $stat_name, $current ) ) { if (array_key_exists($stat_name, $current)) {
if ( is_numeric( $stat['footer'] ) ) { if (is_numeric($stat['footer'])) {
$column_order[$stat_name]['footer'] += $current[$stat_name]; $column_order[$stat_name]['footer'] += $current[$stat_name];
} }
if ( $stat['format'] === 'byte' ) { if ($stat['format'] === 'byte') {
list( $value, $unit ) = PMA_formatByteDown( $current[$stat_name], 3, 1 ); list($value, $unit) = PMA_formatByteDown($current[$stat_name], 3, 1);
} elseif ( $stat['format'] === 'number' ) { } elseif ($stat['format'] === 'number') {
$value = PMA_formatNumber( $current[$stat_name], 0 ); $value = PMA_formatNumber($current[$stat_name], 0);
} else { } else {
$value = htmlentities( $current[$stat_name], 0 ); $value = htmlentities($current[$stat_name], 0);
} }
echo ' <td class="value">'; echo ' <td class="value">';
if ( isset( $stat['description_function'] ) ) { if (isset($stat['description_function'])) {
echo '<dfn title="' . $stat['description_function']( $current[$stat_name] ) . '">'; echo '<dfn title="' . $stat['description_function']($current[$stat_name]) . '">';
} }
echo $value; echo $value;
if ( isset( $stat['description_function'] ) ) { if (isset($stat['description_function'])) {
echo '</dfn>'; echo '</dfn>';
} }
echo '</td>' . "\n"; echo '</td>' . "\n";
if ( $stat['format'] === 'byte' ) { if ($stat['format'] === 'byte') {
echo ' <td class="unit">' . $unit . '</td>' . "\n"; echo ' <td class="unit">' . $unit . '</td>' . "\n";
} }
} }
@@ -300,42 +300,42 @@ if ($databases_count > 0) {
if ($is_superuser) { if ($is_superuser) {
echo ' <td class="tool">' . "\n" echo ' <td class="tool">' . "\n"
. ' <a onclick="window.parent.setDb(\'' . urlencode($current['SCHEMA_NAME']) . '\');" href="./server_privileges.php?' . $url_query . '&amp;checkprivs=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf($strCheckPrivsLong, htmlspecialchars($current['SCHEMA_NAME'])) . '">'. "\n" . ' <a onclick="window.parent.setDb(\'' . urlencode($current['SCHEMA_NAME']) . '\');" href="./server_privileges.php?' . $url_query . '&amp;checkprivs=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf($strCheckPrivsLong, htmlspecialchars($current['SCHEMA_NAME'])) . '">'. "\n"
. ' ' .($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_rights.png" width="16" height="16" alt=" ' .$strCheckPrivs . '" /> ' : $strCheckPrivs ). "\n" . ' ' .($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_rights.png" width="16" height="16" alt=" ' .$strCheckPrivs . '" /> ' : $strCheckPrivs). "\n"
. ' </a></td>' . "\n"; . ' </a></td>' . "\n";
} }
echo '</tr>' . "\n"; echo '</tr>' . "\n";
} // end foreach ( $databases as $key => $current ) } // end foreach ($databases as $key => $current)
unset($current, $odd_row); unset($current, $odd_row);
echo '<tr>' . "\n"; echo '<tr>' . "\n";
if ( $is_superuser || $cfg['AllowUserDropDatabase'] ) { if ($is_superuser || $cfg['AllowUserDropDatabase']) {
echo ' <th>&nbsp;</th>' . "\n"; echo ' <th>&nbsp;</th>' . "\n";
} }
echo ' <th>' . $strTotalUC . ': ' . $databases_count . '</th>' . "\n"; echo ' <th>' . $strTotalUC . ': ' . $databases_count . '</th>' . "\n";
foreach ( $column_order as $stat_name => $stat ) { foreach ($column_order as $stat_name => $stat) {
if ( array_key_exists( $stat_name, $first_database ) ) { if (array_key_exists($stat_name, $first_database)) {
if ( $stat['format'] === 'byte' ) { if ($stat['format'] === 'byte') {
list( $value, $unit ) = PMA_formatByteDown( $stat['footer'], 3, 1 ); list($value, $unit) = PMA_formatByteDown($stat['footer'], 3, 1);
} elseif ( $stat['format'] === 'number' ) { } elseif ($stat['format'] === 'number') {
$value = PMA_formatNumber( $stat['footer'], 0 ); $value = PMA_formatNumber($stat['footer'], 0);
} else { } else {
$value = htmlentities( $stat['footer'], 0 ); $value = htmlentities($stat['footer'], 0);
} }
echo ' <th class="value">'; echo ' <th class="value">';
if ( isset( $stat['description_function'] ) ) { if (isset($stat['description_function'])) {
echo '<dfn title="' . $stat['description_function']( $stat['footer'] ) . '">'; echo '<dfn title="' . $stat['description_function']($stat['footer']) . '">';
} }
echo $value; echo $value;
if ( isset( $stat['description_function'] ) ) { if (isset($stat['description_function'])) {
echo '</dfn>'; echo '</dfn>';
} }
echo '</th>' . "\n"; echo '</th>' . "\n";
if ( $stat['format'] === 'byte' ) { if ($stat['format'] === 'byte') {
echo ' <th class="unit">' . $unit . '</th>' . "\n"; echo ' <th class="unit">' . $unit . '</th>' . "\n";
} }
} }
} }
if ( $is_superuser ) { if ($is_superuser) {
echo ' <th>&nbsp;</th>' . "\n"; echo ' <th>&nbsp;</th>' . "\n";
} }
echo '</tr>' . "\n"; echo '</tr>' . "\n";
@@ -346,16 +346,16 @@ if ($databases_count > 0) {
if ($is_superuser || $cfg['AllowUserDropDatabase']) { if ($is_superuser || $cfg['AllowUserDropDatabase']) {
$common_url_query = PMA_generate_common_url() . '&amp;sort_by=' . $sort_by . '&amp;sort_order=' . $sort_order . '&amp;dbstats=' . $dbstats; $common_url_query = PMA_generate_common_url() . '&amp;sort_by=' . $sort_by . '&amp;sort_order=' . $sort_order . '&amp;dbstats=' . $dbstats;
echo '<img class="selectallarrow" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" width="38" height="22" alt="' . $strWithChecked . '" />' . "\n" echo '<img class="selectallarrow" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" width="38" height="22" alt="' . $strWithChecked . '" />' . "\n"
. '<a href="./server_databases.php?' . $common_url_query . '&amp;checkall=1" onclick="if ( markAllRows(\'tabledatabases\') ) return false;">' . "\n" . '<a href="./server_databases.php?' . $common_url_query . '&amp;checkall=1" onclick="if (markAllRows(\'tabledatabases\')) return false;">' . "\n"
. ' ' . $strCheckAll . '</a> / ' . "\n" . ' ' . $strCheckAll . '</a> / ' . "\n"
. '<a href="./server_databases.php?' . $common_url_query . '" onclick="if ( unMarkAllRows(\'tabledatabases\') ) return false;">' . "\n" . '<a href="./server_databases.php?' . $common_url_query . '" onclick="if (unMarkAllRows(\'tabledatabases\')) return false;">' . "\n"
. ' ' . $strUncheckAll . '</a>' . "\n" . ' ' . $strUncheckAll . '</a>' . "\n"
. '<i>' . $strWithChecked . '</i>' . "\n"; . '<i>' . $strWithChecked . '</i>' . "\n";
PMA_buttonOrImage( 'drop_selected_dbs', 'mult_submit', 'drop_selected_dbs', $strDrop, 'b_deltbl.png' ); PMA_buttonOrImage('drop_selected_dbs', 'mult_submit', 'drop_selected_dbs', $strDrop, 'b_deltbl.png');
} }
echo '<ul><li id="li_switch_dbstats"><strong>' . "\n"; echo '<ul><li id="li_switch_dbstats"><strong>' . "\n";
if ( empty( $dbstats ) ) { if (empty($dbstats)) {
echo ' <a href="./server_databases.php?' . $url_query . '&amp;dbstats=1"' echo ' <a href="./server_databases.php?' . $url_query . '&amp;dbstats=1"'
.' title="' . $strDatabasesStatsEnable . '">' . "\n" .' title="' . $strDatabasesStatsEnable . '">' . "\n"
.' ' . $strDatabasesStatsEnable; .' ' . $strDatabasesStatsEnable;

View File

@@ -9,8 +9,8 @@
/** /**
* *
*/ */
if ( ! defined( 'PMA_NO_VARIABLES_IMPORT' ) ) { if (! defined('PMA_NO_VARIABLES_IMPORT')) {
define( 'PMA_NO_VARIABLES_IMPORT', true ); define('PMA_NO_VARIABLES_IMPORT', true);
} }
/** /**
@@ -89,15 +89,15 @@ function PMA_generateEngineDetails($variables, $like = null) {
$is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE $is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE
|| $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC; || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC;
$dt_table .= '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n" $dt_table .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n"
. ' <td>' . "\n"; . ' <td>' . "\n";
if (!empty($variables[$var]['desc'])) { if (!empty($variables[$var]['desc'])) {
$dt_table .= ' ' . PMA_showHint($details['desc']) . "\n"; $dt_table .= ' ' . PMA_showHint($details['desc']) . "\n";
} }
$dt_table .= ' </td>' . "\n" $dt_table .= ' </td>' . "\n"
. ' <th>' . ' <th>'
. htmlspecialchars( empty($details['title']) . htmlspecialchars(empty($details['title'])
? $var : $details['title'] ) . "\n" ? $var : $details['title']) . "\n"
. ' </th>' . "\n" . ' </th>' . "\n"
. ' <td class="value">'; . ' <td class="value">';
switch ($details['type']) { switch ($details['type']) {
@@ -131,8 +131,8 @@ function PMA_generateEngineDetails($variables, $like = null) {
/** /**
* Did the user request information about a certain storage engine? * Did the user request information about a certain storage engine?
*/ */
if ( empty($_REQUEST['engine']) if (empty($_REQUEST['engine'])
|| empty($mysql_storage_engines[$_REQUEST['engine']]) ) { || empty($mysql_storage_engines[$_REQUEST['engine']])) {
/** /**
* Displays the sub-page heading * Displays the sub-page heading
@@ -140,7 +140,7 @@ if ( empty($_REQUEST['engine'])
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($GLOBALS['cfg']['MainPageIconic'] . ($GLOBALS['cfg']['MainPageIconic']
? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"' ? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"'
.' width="16" height="16" alt="" />' : '' ) .' width="16" height="16" alt="" />' : '')
. "\n" . $strStorageEngines . "\n" . "\n" . $strStorageEngines . "\n"
. '</h2>' . "\n"; . '</h2>' . "\n";
@@ -171,7 +171,7 @@ if ( empty($_REQUEST['engine'])
: '') : '')
. '">' . "\n" . '">' . "\n"
. ' <td><a href="./server_engines.php' . ' <td><a href="./server_engines.php'
. PMA_generate_common_url(array( 'engine' => $engine )) . '">' . "\n" . PMA_generate_common_url(array('engine' => $engine)) . '">' . "\n"
. ' ' . htmlspecialchars($details['Engine']) . "\n" . ' ' . htmlspecialchars($details['Engine']) . "\n"
. ' </a>' . "\n" . ' </a>' . "\n"
. ' </td>' . "\n"; . ' </td>' . "\n";
@@ -196,9 +196,9 @@ if ( empty($_REQUEST['engine'])
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($GLOBALS['cfg']['MainPageIconic'] . ($GLOBALS['cfg']['MainPageIconic']
? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"' ? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"'
.' width="16" height="16" alt="" />' : '' ) .' width="16" height="16" alt="" />' : '')
. ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n" . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n"
. ' ' . PMA_showMySQLDocu( '', $engine_plugin->getMysqlHelpPage() ) . "\n" . ' ' . PMA_showMySQLDocu('', $engine_plugin->getMysqlHelpPage()) . "\n"
. '</h2>' . "\n\n"; . '</h2>' . "\n\n";
if (PMA_MYSQL_INT_VERSION >= 40102) { if (PMA_MYSQL_INT_VERSION >= 40102) {
echo '<p>' . "\n" echo '<p>' . "\n"
@@ -215,7 +215,7 @@ if ( empty($_REQUEST['engine'])
echo ' <strong>' . $strServerTabVariables . '</strong>' . "\n"; echo ' <strong>' . $strServerTabVariables . '</strong>' . "\n";
} else { } else {
echo ' <a href="./server_engines.php' echo ' <a href="./server_engines.php'
. PMA_generate_common_url(array( 'engine' => $_REQUEST['engine'] )) . '">' . PMA_generate_common_url(array('engine' => $_REQUEST['engine'])) . '">'
. $strServerTabVariables . '</a>' . "\n"; . $strServerTabVariables . '</a>' . "\n";
} }
foreach ($infoPages as $current => $label) { foreach ($infoPages as $current => $label) {
@@ -225,7 +225,7 @@ if ( empty($_REQUEST['engine'])
} else { } else {
echo ' <a href="./server_engines.php' echo ' <a href="./server_engines.php'
. PMA_generate_common_url( . PMA_generate_common_url(
array( 'engine' => $_REQUEST['engine'], 'page' => $current )) array('engine' => $_REQUEST['engine'], 'page' => $current))
. '">' . htmlspecialchars($label) . '</a>' . "\n"; . '">' . htmlspecialchars($label) . '</a>' . "\n";
} }
} }

View File

@@ -30,9 +30,9 @@ if (isset($pred_tablename) && strlen($pred_tablename)) {
} }
// check if given $dbanem is a wildcard or not // check if given $dbanem is a wildcard or not
if ( isset( $dbname ) ) { if (isset($dbname)) {
//if ( preg_match( '/\\\\(?:_|%)/i', $dbname ) ) { //if (preg_match('/\\\\(?:_|%)/i', $dbname)) {
if ( preg_match( '/(?<!\\\\)(?:_|%)/i', $dbname ) ) { if (preg_match('/(?<!\\\\)(?:_|%)/i', $dbname)) {
$dbname_is_wildcard = true; $dbname_is_wildcard = true;
} else { } else {
$dbname_is_wildcard = false; $dbname_is_wildcard = false;
@@ -123,7 +123,7 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE)
if (!empty($row) && isset($row['Table_priv'])) { if (!empty($row) && isset($row['Table_priv'])) {
$res = PMA_DBI_query( $res = PMA_DBI_query(
'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', 'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';',
$GLOBALS['userlink'] ); $GLOBALS['userlink']);
$row1 = PMA_DBI_fetch_assoc($res); $row1 = PMA_DBI_fetch_assoc($res);
PMA_DBI_free_result($res); PMA_DBI_free_result($res);
$av_grants = explode ('\',\'', substr($row1['Type'], 5, strlen($row1['Type']) - 7)); $av_grants = explode ('\',\'', substr($row1['Type'], 5, strlen($row1['Type']) - 7));
@@ -219,7 +219,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
if ($db == '*') { if ($db == '*') {
$table = '*'; $table = '*';
} }
$spaces = str_repeat( ' ', $indent ); $spaces = str_repeat(' ', $indent);
if (isset($GLOBALS['username'])) { if (isset($GLOBALS['username'])) {
$username = $GLOBALS['username']; $username = $GLOBALS['username'];
@@ -238,8 +238,8 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
.' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') .' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted')
.' AND ' . PMA_convert_using('`Host`') .' AND ' . PMA_convert_using('`Host`')
.' = ' . PMA_convert_using($hostname, 'quoted') .' = ' . PMA_convert_using($hostname, 'quoted')
.' AND ' . PMA_convert_using( PMA_unescape_mysql_wildcards( $db ), 'quoted' ) .' AND ' . PMA_convert_using(PMA_unescape_mysql_wildcards($db), 'quoted')
.' LIKE ' . PMA_convert_using( '`Db`' ) . ';'; .' LIKE ' . PMA_convert_using('`Db`') . ';';
} else { } else {
$sql_query = $sql_query =
'SELECT `Table_priv`' 'SELECT `Table_priv`'
@@ -247,9 +247,9 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
.' WHERE ' . PMA_convert_using('`User`') .' WHERE ' . PMA_convert_using('`User`')
.' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') .' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted')
.' AND ' .PMA_convert_using('`Host`') .' AND ' .PMA_convert_using('`Host`')
.' = ' . PMA_convert_using( $hostname, 'quoted' ) .' = ' . PMA_convert_using($hostname, 'quoted')
.' AND ' .PMA_convert_using('`Db`') .' AND ' .PMA_convert_using('`Db`')
.' = ' . PMA_convert_using( PMA_unescape_mysql_wildcards( $db ), 'quoted' ) .' = ' . PMA_convert_using(PMA_unescape_mysql_wildcards($db), 'quoted')
.' AND ' . PMA_convert_using('`Table_name`') .' AND ' . PMA_convert_using('`Table_name`')
.' = ' . PMA_convert_using($table, 'quoted') . ';'; .' = ' . PMA_convert_using($table, 'quoted') . ';';
} }
@@ -280,7 +280,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
if (isset($row['Table_priv'])) { if (isset($row['Table_priv'])) {
$res = PMA_DBI_query( $res = PMA_DBI_query(
'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', 'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';',
$GLOBALS['userlink'] ); $GLOBALS['userlink']);
// note: in MySQL 5.0.3 we get "Create View', 'Show view'; // note: in MySQL 5.0.3 we get "Create View', 'Show view';
// the View for Create is spelled with uppercase V // the View for Create is spelled with uppercase V
// the view for Show is spelled with lowercase v // the view for Show is spelled with lowercase v
@@ -298,9 +298,9 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
unset($row['Table_priv'], $current_grant, $av_grants, $users_grants); unset($row['Table_priv'], $current_grant, $av_grants, $users_grants);
// get collumns // get collumns
$res = PMA_DBI_try_query('SHOW COLUMNS FROM `' . PMA_unescape_mysql_wildcards( $db ) . '`.`' . $table . '`;'); $res = PMA_DBI_try_query('SHOW COLUMNS FROM `' . PMA_unescape_mysql_wildcards($db) . '`.`' . $table . '`;');
$columns = array(); $columns = array();
if ( $res ) { if ($res) {
while ($row1 = PMA_DBI_fetch_row($res)) { while ($row1 = PMA_DBI_fetch_row($res)) {
$columns[$row1[0]] = array( $columns[$row1[0]] = array(
'Select' => FALSE, 'Select' => FALSE,
@@ -314,7 +314,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
unset($res, $row1); unset($res, $row1);
} }
// t a b l e - s p e c i f i c p r i v i l e g e s // t a b l e - s p e c i f i c p r i v i l e g e s
if ( ! empty( $columns ) ) { if (! empty($columns)) {
$res = PMA_DBI_query( $res = PMA_DBI_query(
'SELECT `Column_name`, `Column_priv`' 'SELECT `Column_name`, `Column_priv`'
.' FROM `mysql`.`columns_priv`' .' FROM `mysql`.`columns_priv`'
@@ -323,7 +323,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
.' AND ' . PMA_convert_using('`Host`') .' AND ' . PMA_convert_using('`Host`')
.' = ' . PMA_convert_using($hostname, 'quoted') .' = ' . PMA_convert_using($hostname, 'quoted')
.' AND ' . PMA_convert_using('`Db`') .' AND ' . PMA_convert_using('`Db`')
.' = ' . PMA_convert_using( PMA_unescape_mysql_wildcards( $db ), 'quoted') .' = ' . PMA_convert_using(PMA_unescape_mysql_wildcards($db), 'quoted')
.' AND ' . PMA_convert_using('`Table_name`') .' AND ' . PMA_convert_using('`Table_name`')
.' = ' . PMA_convert_using($table, 'quoted') . ';'); .' = ' . PMA_convert_using($table, 'quoted') . ';');
@@ -334,7 +334,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
} }
} }
PMA_DBI_free_result($res); PMA_DBI_free_result($res);
unset( $res, $row1, $current ); unset($res, $row1, $current);
echo $spaces . '<input type="hidden" name="grant_count" value="' . count($row) . '" />' . "\n" echo $spaces . '<input type="hidden" name="grant_count" value="' . count($row) . '" />' . "\n"
. $spaces . '<input type="hidden" name="column_count" value="' . count($columns) . '" />' . "\n" . $spaces . '<input type="hidden" name="column_count" value="' . count($columns) . '" />' . "\n"
@@ -476,13 +476,13 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
. $spaces . '<fieldset id="fieldset_user_global_rights">' . "\n" . $spaces . '<fieldset id="fieldset_user_global_rights">' . "\n"
. $spaces . ' <legend>' . "\n" . $spaces . ' <legend>' . "\n"
. $spaces . ' ' . ($db == '*' ? $GLOBALS['strGlobalPrivileges'] : ($table == '*' ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges'])) . "\n" . $spaces . ' ' . ($db == '*' ? $GLOBALS['strGlobalPrivileges'] : ($table == '*' ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges'])) . "\n"
. $spaces . ' ( <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;checkall=1" onclick="setCheckboxes(\'usersForm\', true); return false;">' . $GLOBALS['strCheckAll'] . '</a> /' . "\n" . $spaces . ' (<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;checkall=1" onclick="setCheckboxes(\'usersForm\', true); return false;">' . $GLOBALS['strCheckAll'] . '</a> /' . "\n"
. $spaces . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'usersForm\', false); return false;">' . $GLOBALS['strUncheckAll'] . '</a> )' . "\n" . $spaces . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'usersForm\', false); return false;">' . $GLOBALS['strUncheckAll'] . '</a>)' . "\n"
. $spaces . ' </legend>' . "\n" . $spaces . ' </legend>' . "\n"
. $spaces . ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n" . $spaces . ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n"
. $spaces . ' <fieldset>' . "\n" . $spaces . ' <fieldset>' . "\n"
. $spaces . ' <legend>' . $GLOBALS['strData'] . '</legend>' . "\n"; . $spaces . ' <legend>' . $GLOBALS['strData'] . '</legend>' . "\n";
foreach ( $privTable[0] as $priv ) foreach ($privTable[0] as $priv)
{ {
echo $spaces . ' <div class="item">' . "\n" echo $spaces . ' <div class="item">' . "\n"
. $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n" . $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n"
@@ -492,7 +492,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
echo $spaces . ' </fieldset>' . "\n" echo $spaces . ' </fieldset>' . "\n"
. $spaces . ' <fieldset>' . "\n" . $spaces . ' <fieldset>' . "\n"
. $spaces . ' <legend>' . $GLOBALS['strStructure'] . '</legend>' . "\n"; . $spaces . ' <legend>' . $GLOBALS['strStructure'] . '</legend>' . "\n";
foreach ( $privTable[1] as $priv ) foreach ($privTable[1] as $priv)
{ {
echo $spaces . ' <div class="item">' . "\n" echo $spaces . ' <div class="item">' . "\n"
. $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n" . $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n"
@@ -502,7 +502,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
echo $spaces . ' </fieldset>' . "\n" echo $spaces . ' </fieldset>' . "\n"
. $spaces . ' <fieldset>' . "\n" . $spaces . ' <fieldset>' . "\n"
. $spaces . ' <legend>' . $GLOBALS['strAdministration'] . '</legend>' . "\n"; . $spaces . ' <legend>' . $GLOBALS['strAdministration'] . '</legend>' . "\n";
foreach ( $privTable[2] as $priv ) foreach ($privTable[2] as $priv)
{ {
echo $spaces . ' <div class="item">' . "\n" echo $spaces . ' <div class="item">' . "\n"
. $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n" . $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n"
@@ -562,8 +562,8 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
* *
* @return void * @return void
*/ */
function PMA_displayLoginInformationFields($mode = 'new', $indent = 0 ) { function PMA_displayLoginInformationFields($mode = 'new', $indent = 0) {
$spaces = str_repeat( ' ', $indent); $spaces = str_repeat(' ', $indent);
// Get user/host name lengths // Get user/host name lengths
$fields_info = PMA_DBI_get_fields('mysql', 'user'); $fields_info = PMA_DBI_get_fields('mysql', 'user');
@@ -586,7 +586,7 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0 ) {
} }
unset($fields_info); unset($fields_info);
if ( isset( $GLOBALS['username'] ) && strlen( $GLOBALS['username'] ) === 0 ) { if (isset($GLOBALS['username']) && strlen($GLOBALS['username']) === 0) {
$GLOBALS['pred_username'] = 'any'; $GLOBALS['pred_username'] = 'any';
} }
echo $spaces . '<fieldset id="fieldset_add_user_login">' . "\n" echo $spaces . '<fieldset id="fieldset_add_user_login">' . "\n"
@@ -650,7 +650,7 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0 ) {
. $spaces . ' <option value="userdefined"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'userdefined') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" . $spaces . ' <option value="userdefined"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'userdefined') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"
. $spaces . ' </select>' . "\n" . $spaces . ' </select>' . "\n"
. $spaces . '</span>' . "\n" . $spaces . '</span>' . "\n"
. $spaces . '<input type="text" name="hostname" maxlength="' . $hostname_length . '" value="' . ( isset($GLOBALS['hostname']) ? $GLOBALS['hostname'] : '' ) . '" title="' . $GLOBALS['strHost'] . '" onchange="pred_hostname.value = \'userdefined\';" />' . "\n" . $spaces . '<input type="text" name="hostname" maxlength="' . $hostname_length . '" value="' . (isset($GLOBALS['hostname']) ? $GLOBALS['hostname'] : '') . '" title="' . $GLOBALS['strHost'] . '" onchange="pred_hostname.value = \'userdefined\';" />' . "\n"
. $spaces . '</div>' . "\n" . $spaces . '</div>' . "\n"
. $spaces . '<div class="item">' . "\n" . $spaces . '<div class="item">' . "\n"
. $spaces . '<label for="select_pred_password">' . "\n" . $spaces . '<label for="select_pred_password">' . "\n"
@@ -661,11 +661,11 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0 ) {
. $spaces . ' onchange="if (this.value == \'none\') { pma_pw.value = \'\'; pma_pw2.value = \'\'; } else if (this.value == \'userdefined\') { pma_pw.focus(); pma_pw.select(); }">' . "\n" . $spaces . ' onchange="if (this.value == \'none\') { pma_pw.value = \'\'; pma_pw2.value = \'\'; } else if (this.value == \'userdefined\') { pma_pw.focus(); pma_pw.select(); }">' . "\n"
. ($mode == 'change' ? $spaces . ' <option value="keep" selected="selected">' . $GLOBALS['strKeepPass'] . '</option>' . "\n" : '') . ($mode == 'change' ? $spaces . ' <option value="keep" selected="selected">' . $GLOBALS['strKeepPass'] . '</option>' . "\n" : '')
. $spaces . ' <option value="none"'; . $spaces . ' <option value="none"';
if ( isset( $GLOBALS['username'] ) && $mode != 'change' ) { if (isset($GLOBALS['username']) && $mode != 'change') {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo $spaces . '>' . $GLOBALS['strNoPassword'] . '</option>' . "\n" echo $spaces . '>' . $GLOBALS['strNoPassword'] . '</option>' . "\n"
. $spaces . ' <option value="userdefined"' . ( isset( $GLOBALS['username'] ) ? '' : ' selected="selected"') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" . $spaces . ' <option value="userdefined"' . (isset($GLOBALS['username']) ? '' : ' selected="selected"') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"
. $spaces . ' </select>' . "\n" . $spaces . ' </select>' . "\n"
. $spaces . '</span>' . "\n" . $spaces . '</span>' . "\n"
. $spaces . '<input type="password" id="text_pma_pw" name="pma_pw" title="' . $GLOBALS['strPassword'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n" . $spaces . '<input type="password" id="text_pma_pw" name="pma_pw" title="' . $GLOBALS['strPassword'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n"
@@ -773,19 +773,19 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
$pma_pw_hidden = str_repeat('*', strlen($pma_pw)); $pma_pw_hidden = str_repeat('*', strlen($pma_pw));
$sql_query = $real_sql_query . ' IDENTIFIED BY \'' . $pma_pw_hidden . '\''; $sql_query = $real_sql_query . ' IDENTIFIED BY \'' . $pma_pw_hidden . '\'';
$real_sql_query .= ' IDENTIFIED BY \'' . PMA_sqlAddslashes($pma_pw) . '\''; $real_sql_query .= ' IDENTIFIED BY \'' . PMA_sqlAddslashes($pma_pw) . '\'';
if ( isset( $create_user_real ) ) { if (isset($create_user_real)) {
$create_user_show = $create_user_real . ' IDENTIFIED BY \'' . $pma_pw_hidden . '\''; $create_user_show = $create_user_real . ' IDENTIFIED BY \'' . $pma_pw_hidden . '\'';
$create_user_real .= ' IDENTIFIED BY \'' . PMA_sqlAddslashes($pma_pw) . '\''; $create_user_real .= ' IDENTIFIED BY \'' . PMA_sqlAddslashes($pma_pw) . '\'';
} }
} else { } else {
if ($pred_password == 'keep' && !empty($password)) { if ($pred_password == 'keep' && !empty($password)) {
$real_sql_query .= ' IDENTIFIED BY PASSWORD \'' . $password . '\''; $real_sql_query .= ' IDENTIFIED BY PASSWORD \'' . $password . '\'';
if ( isset( $create_user_real ) ) { if (isset($create_user_real)) {
$create_user_real .= ' IDENTIFIED BY PASSWORD \'' . $password . '\''; $create_user_real .= ' IDENTIFIED BY PASSWORD \'' . $password . '\'';
} }
} }
$sql_query = $real_sql_query; $sql_query = $real_sql_query;
if ( isset( $create_user_real ) ) { if (isset($create_user_real)) {
$create_user_show = $create_user_real; $create_user_show = $create_user_real;
} }
} }
@@ -825,14 +825,14 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
} }
} }
} }
if ( isset( $create_user_real ) ) { if (isset($create_user_real)) {
$create_user_real .= ';'; $create_user_real .= ';';
$create_user_show .= ';'; $create_user_show .= ';';
} }
$real_sql_query .= ';'; $real_sql_query .= ';';
$sql_query .= ';'; $sql_query .= ';';
if (empty($change_copy)) { if (empty($change_copy)) {
if ( isset( $create_user_real ) ) { if (isset($create_user_real)) {
PMA_DBI_try_query($create_user_real) or PMA_mysqlDie(PMA_DBI_getError(), $create_user_show); PMA_DBI_try_query($create_user_real) or PMA_mysqlDie(PMA_DBI_getError(), $create_user_show);
$sql_query = $create_user_show . $sql_query; $sql_query = $create_user_show . $sql_query;
} }
@@ -858,7 +858,7 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
} }
} }
} else { } else {
if ( isset( $create_user_real ) ) { if (isset($create_user_real)) {
$queries[] = $create_user_real; $queries[] = $create_user_real;
} }
$queries[] = $real_sql_query; $queries[] = $real_sql_query;
@@ -866,7 +866,7 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
// $queries_for_display, at the same position occupied // $queries_for_display, at the same position occupied
// by the real query in $queries // by the real query in $queries
$tmp_count = count($queries); $tmp_count = count($queries);
if ( isset( $create_user_real ) ) { if (isset($create_user_real)) {
$queries_for_display[$tmp_count - 2] = $create_user_show; $queries_for_display[$tmp_count - 2] = $create_user_show;
} }
$queries_for_display[$tmp_count - 1] = $sql_query; $queries_for_display[$tmp_count - 1] = $sql_query;
@@ -885,19 +885,19 @@ if (!empty($change_copy)) {
.' = ' . PMA_convert_using(PMA_sqlAddslashes($old_username), 'quoted') .' = ' . PMA_convert_using(PMA_sqlAddslashes($old_username), 'quoted')
.' AND ' . PMA_convert_using('Host') .' AND ' . PMA_convert_using('Host')
.' = ' . PMA_convert_using($old_hostname, 'quoted') . ';'; .' = ' . PMA_convert_using($old_hostname, 'quoted') . ';';
$res = PMA_DBI_query('SELECT * FROM `mysql`.`db`' . $user_host_condition ); $res = PMA_DBI_query('SELECT * FROM `mysql`.`db`' . $user_host_condition);
while ($row = PMA_DBI_fetch_assoc($res)) { while ($row = PMA_DBI_fetch_assoc($res)) {
$queries[] = $queries[] =
'GRANT ' . join(', ', PMA_extractPrivInfo($row)) 'GRANT ' . join(', ', PMA_extractPrivInfo($row))
.' ON `' . $row['Db'] . '`.*' .' ON `' . $row['Db'] . '`.*'
.' TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\'' .' TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\''
. ( $row['Grant_priv'] == 'Y' ? ' WITH GRANT OPTION;' : ';' ); . ($row['Grant_priv'] == 'Y' ? ' WITH GRANT OPTION;' : ';');
} }
PMA_DBI_free_result($res); PMA_DBI_free_result($res);
$res = PMA_DBI_query( $res = PMA_DBI_query(
'SELECT `Db`, `Table_name`, `Table_priv`' 'SELECT `Db`, `Table_name`, `Table_priv`'
.' FROM `mysql`.`tables_priv`' . $user_host_condition, .' FROM `mysql`.`tables_priv`' . $user_host_condition,
$GLOBALS['userlink'], PMA_DBI_QUERY_STORE ); $GLOBALS['userlink'], PMA_DBI_QUERY_STORE);
while ($row = PMA_DBI_fetch_assoc($res)) { while ($row = PMA_DBI_fetch_assoc($res)) {
$res2 = PMA_DBI_QUERY( $res2 = PMA_DBI_QUERY(
@@ -977,11 +977,11 @@ if (!empty($update_privs)) {
if (! isset($dbname) || ! strlen($dbname)) { if (! isset($dbname) || ! strlen($dbname)) {
$db_and_table = '*.*'; $db_and_table = '*.*';
} else { } else {
if ( isset( $tablename ) && strlen($tablename) ) { if (isset($tablename) && strlen($tablename)) {
$db_and_table = PMA_backquote( PMA_unescape_mysql_wildcards( $dbname ) ) . '.'; $db_and_table = PMA_backquote(PMA_unescape_mysql_wildcards($dbname)) . '.';
$db_and_table .= PMA_backquote( $tablename ); $db_and_table .= PMA_backquote($tablename);
} else { } else {
$db_and_table = PMA_backquote( $dbname ) . '.'; $db_and_table = PMA_backquote($dbname) . '.';
$db_and_table .= '*'; $db_and_table .= '*';
} }
} }
@@ -1002,9 +1002,9 @@ if (!empty($update_privs)) {
/** /**
* @todo similar code appears twice in this script * @todo similar code appears twice in this script
*/ */
if ( ( isset($Grant_priv) && $Grant_priv == 'Y') if ((isset($Grant_priv) && $Grant_priv == 'Y')
|| ( ( ! isset($dbname) || ! strlen($dbname) ) && PMA_MYSQL_INT_VERSION >= 40002 || ((! isset($dbname) || ! strlen($dbname)) && PMA_MYSQL_INT_VERSION >= 40002
&& ( isset($max_questions) || isset($max_connections) && (isset($max_questions) || isset($max_connections)
|| isset($max_updates) || isset($max_user_connections)))) || isset($max_updates) || isset($max_user_connections))))
{ {
$sql_query2 .= 'WITH'; $sql_query2 .= 'WITH';
@@ -1056,15 +1056,15 @@ if (!empty($update_privs)) {
*/ */
if (!empty($revokeall)) { if (!empty($revokeall)) {
if ( ! isset($dbname) || ! strlen($dbname) ) { if (! isset($dbname) || ! strlen($dbname)) {
$db_and_table = '*.*'; $db_and_table = '*.*';
} else { } else {
if ( ! isset( $tablename ) || ! strlen($tablename) ) { if (! isset($tablename) || ! strlen($tablename)) {
$db_and_table = PMA_backquote( $dbname ) . '.'; $db_and_table = PMA_backquote($dbname) . '.';
$db_and_table .= '*'; $db_and_table .= '*';
} else { } else {
$db_and_table = PMA_backquote( PMA_unescape_mysql_wildcards( $dbname ) ) . '.'; $db_and_table = PMA_backquote(PMA_unescape_mysql_wildcards($dbname)) . '.';
$db_and_table .= PMA_backquote( $tablename ); $db_and_table .= PMA_backquote($tablename);
} }
} }
@@ -1080,7 +1080,7 @@ if (!empty($revokeall)) {
} }
$sql_query = $sql_query0 . (isset($sql_query1) ? ' ' . $sql_query1 : ''); $sql_query = $sql_query0 . (isset($sql_query1) ? ' ' . $sql_query1 : '');
$message = sprintf($GLOBALS['strRevokeMessage'], '\'' . $username . '\'@\'' . $hostname . '\''); $message = sprintf($GLOBALS['strRevokeMessage'], '\'' . $username . '\'@\'' . $hostname . '\'');
if ( ! isset($tablename) || ! strlen($tablename) ) { if (! isset($tablename) || ! strlen($tablename)) {
unset($dbname); unset($dbname);
} else { } else {
unset($tablename); unset($tablename);
@@ -1128,7 +1128,7 @@ if (!empty($delete) || (!empty($change_copy) && $mode < 4)) {
for ($i = 0; isset($selected_usr[$i]); $i++) { for ($i = 0; isset($selected_usr[$i]); $i++) {
list($this_user, $this_host) = explode($user_host_separator, $selected_usr[$i]); list($this_user, $this_host) = explode($user_host_separator, $selected_usr[$i]);
$queries[] = '# ' . sprintf($GLOBALS['strDeleting'], '\'' . $this_user . '\'@\'' . $this_host . '\'') . ' ...'; $queries[] = '# ' . sprintf($GLOBALS['strDeleting'], '\'' . $this_user . '\'@\'' . $this_host . '\'') . ' ...';
if ( PMA_MYSQL_INT_VERSION >= 50002 ) { if (PMA_MYSQL_INT_VERSION >= 50002) {
$queries[] = 'DROP USER \'' . PMA_sqlAddslashes($this_user) . '\'@\'' . $this_host . '\';'; $queries[] = 'DROP USER \'' . PMA_sqlAddslashes($this_user) . '\'@\'' . $this_host . '\';';
} else { } else {
if ($mode == 2) { if ($mode == 2) {
@@ -1152,7 +1152,7 @@ if (!empty($delete) || (!empty($change_copy) && $mode < 4)) {
} }
unset($res); unset($res);
} }
if ( PMA_MYSQL_INT_VERSION >= 40101 ) { if (PMA_MYSQL_INT_VERSION >= 40101) {
if (PMA_MYSQL_INT_VERSION < 50002) { if (PMA_MYSQL_INT_VERSION < 50002) {
$queries[] = 'REVOKE GRANT OPTION ON *.* FROM \'' . PMA_sqlAddslashes($this_user) . '\'@\'' . $this_host . '\';'; $queries[] = 'REVOKE GRANT OPTION ON *.* FROM \'' . PMA_sqlAddslashes($this_user) . '\'@\'' . $this_host . '\';';
} }
@@ -1256,7 +1256,7 @@ $link_edit = '<a href="server_privileges.php?' . $GLOBALS['url_query']
.'&amp;hostname=%s' .'&amp;hostname=%s'
.'&amp;dbname=%s' .'&amp;dbname=%s'
.'&amp;tablename=%s">'; .'&amp;tablename=%s">';
if ( $GLOBALS['cfg']['PropertiesIconic'] ) { if ($GLOBALS['cfg']['PropertiesIconic']) {
$link_edit .= '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_usredit.png" width="16" height="16" alt="' . $GLOBALS['strEditPrivileges'] . '" title="' . $GLOBALS['strEditPrivileges'] . '" />'; $link_edit .= '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_usredit.png" width="16" height="16" alt="' . $GLOBALS['strEditPrivileges'] . '" title="' . $GLOBALS['strEditPrivileges'] . '" />';
} else { } else {
$link_edit .= $GLOBALS['strEditPrivileges']; $link_edit .= $GLOBALS['strEditPrivileges'];
@@ -1269,7 +1269,7 @@ $link_revoke = '<a href="server_privileges.php?' . $GLOBALS['url_query']
.'&amp;dbname=%s' .'&amp;dbname=%s'
.'&amp;tablename=%s' .'&amp;tablename=%s'
.'&amp;revokeall=1">'; .'&amp;revokeall=1">';
if ( $GLOBALS['cfg']['PropertiesIconic'] ) { if ($GLOBALS['cfg']['PropertiesIconic']) {
$link_revoke .= '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_usrdrop.png" width="16" height="16" alt="' . $GLOBALS['strRevoke'] . '" title="' . $GLOBALS['strRevoke'] . '" />'; $link_revoke .= '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_usrdrop.png" width="16" height="16" alt="' . $GLOBALS['strRevoke'] . '" title="' . $GLOBALS['strRevoke'] . '" />';
} else { } else {
$link_revoke .= $GLOBALS['strRevoke']; $link_revoke .= $GLOBALS['strRevoke'];
@@ -1279,8 +1279,8 @@ $link_revoke .= '</a>';
/** /**
* Displays the page * Displays the page
*/ */
if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) { if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
if ( ! isset( $username ) ) { if (! isset($username)) {
// No username is given --> display the overview // No username is given --> display the overview
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'b_usrlist.png" alt="" />' : '') . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'b_usrlist.png" alt="" />' : '')
@@ -1356,8 +1356,8 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
); );
$db_rights_sqls = array(); $db_rights_sqls = array();
foreach ( $tables_to_search_for_users as $table_search_in ) { foreach ($tables_to_search_for_users as $table_search_in) {
if ( in_array( $table_search_in, $tables ) ) { if (in_array($table_search_in, $tables)) {
$db_rights_sqls[] = 'SELECT DISTINCT `User`, `Host` FROM `mysql`.`' . $table_search_in . '` ' . (isset($initial) ? PMA_RangeOfUsers($initial) : ''); $db_rights_sqls[] = 'SELECT DISTINCT `User`, `Host` FROM `mysql`.`' . $table_search_in . '` ' . (isset($initial) ? PMA_RangeOfUsers($initial) : '');
} }
} }
@@ -1367,7 +1367,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
'Host' => '%', 'Host' => '%',
'Password' => '?', 'Password' => '?',
'Grant_priv' => 'N', 'Grant_priv' => 'N',
'privs' => array( 'USAGE' ), 'privs' => array('USAGE'),
); );
// for all initials, even non A-Z // for all initials, even non A-Z
@@ -1377,31 +1377,31 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
// do not use UNION DISTINCT, as it's not allowed before // do not use UNION DISTINCT, as it's not allowed before
// MySQL 4.0.17, and because "it does nothing" (cf manual) // MySQL 4.0.17, and because "it does nothing" (cf manual)
if ( PMA_MYSQL_INT_VERSION >= 40000 ) { if (PMA_MYSQL_INT_VERSION >= 40000) {
$db_rights_sql = '(' . implode( ') UNION (', $db_rights_sqls ) . ')' $db_rights_sql = '(' . implode(') UNION (', $db_rights_sqls) . ')'
.' ORDER BY `User` ASC, `Host` ASC'; .' ORDER BY `User` ASC, `Host` ASC';
$db_rights_result = PMA_DBI_query( $db_rights_sql ); $db_rights_result = PMA_DBI_query($db_rights_sql);
while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) {
$db_rights_row = array_merge( $user_defaults, $db_rights_row ); $db_rights_row = array_merge($user_defaults, $db_rights_row);
$db_rights[$db_rights_row['User']][$db_rights_row['Host']] = $db_rights[$db_rights_row['User']][$db_rights_row['Host']] =
$db_rights_row; $db_rights_row;
} }
} else { } else {
foreach ( $db_rights_sqls as $db_rights_sql ) { foreach ($db_rights_sqls as $db_rights_sql) {
$db_rights_result = PMA_DBI_query( $db_rights_sql ); $db_rights_result = PMA_DBI_query($db_rights_sql);
while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) {
$db_rights_row = array_merge( $user_defaults, $db_rights_row ); $db_rights_row = array_merge($user_defaults, $db_rights_row);
$db_rights[$db_rights_row['User']][$db_rights_row['Host']] = $db_rights[$db_rights_row['User']][$db_rights_row['Host']] =
$db_rights_row; $db_rights_row;
} }
} }
} }
PMA_DBI_free_result( $db_rights_result ); PMA_DBI_free_result($db_rights_result);
unset( $db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row ); unset($db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row);
ksort( $db_rights ); ksort($db_rights);
/** /**
* Displays the initials * Displays the initials
@@ -1409,7 +1409,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
// initialize to FALSE the letters A-Z // initialize to FALSE the letters A-Z
for ($letter_counter = 1; $letter_counter < 27; $letter_counter++) { for ($letter_counter = 1; $letter_counter < 27; $letter_counter++) {
if ( ! isset( $array_initials[chr($letter_counter + 64)] ) ) { if (! isset($array_initials[chr($letter_counter + 64)])) {
$array_initials[chr($letter_counter + 64)] = FALSE; $array_initials[chr($letter_counter + 64)] = FALSE;
} }
} }
@@ -1423,7 +1423,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
// just letters. For letters A-Z, we add the non-used letters // just letters. For letters A-Z, we add the non-used letters
// as greyed out. // as greyed out.
uksort( $array_initials, "strnatcasecmp" ); uksort($array_initials, "strnatcasecmp");
echo '<table cellspacing="5"><tr>'; echo '<table cellspacing="5"><tr>';
foreach ($array_initials as $tmp_initial => $initial_was_found) { foreach ($array_initials as $tmp_initial => $initial_was_found) {
@@ -1443,12 +1443,12 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
if (isset($initial) || isset($showall) || PMA_DBI_num_rows($res) < 50) { if (isset($initial) || isset($showall) || PMA_DBI_num_rows($res) < 50) {
while ( $row = PMA_DBI_fetch_assoc( $res ) ) { while ($row = PMA_DBI_fetch_assoc($res)) {
$row['privs'] = PMA_extractPrivInfo( $row, true ); $row['privs'] = PMA_extractPrivInfo($row, true);
$db_rights[$row['User']][$row['Host']] = $row; $db_rights[$row['User']][$row['Host']] = $row;
} }
@PMA_DBI_free_result( $res ); @PMA_DBI_free_result($res);
unset( $res ); unset($res);
echo '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post">' . "\n" echo '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post">' . "\n"
. PMA_generate_common_hidden_inputs('', '', 1) . PMA_generate_common_hidden_inputs('', '', 1)
@@ -1459,7 +1459,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
. ' <th>' . $GLOBALS['strHost'] . '</th>' . "\n" . ' <th>' . $GLOBALS['strHost'] . '</th>' . "\n"
. ' <th>' . $GLOBALS['strPassword'] . '</th>' . "\n" . ' <th>' . $GLOBALS['strPassword'] . '</th>' . "\n"
. ' <th>' . $GLOBALS['strGlobalPrivileges'] . ' ' . ' <th>' . $GLOBALS['strGlobalPrivileges'] . ' '
. PMA_showHint( $GLOBALS['strEnglishPrivileges'] ) . '</th>' . "\n" . PMA_showHint($GLOBALS['strEnglishPrivileges']) . '</th>' . "\n"
. ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n" . ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n"
. ' ' . ($GLOBALS['cfg']['PropertiesIconic'] ? '<td></td>' : '<th>' . $GLOBALS['strAction'] . '</th>') . "\n"; . ' ' . ($GLOBALS['cfg']['PropertiesIconic'] ? '<td></td>' : '<th>' . $GLOBALS['strAction'] . '</th>') . "\n";
echo ' </tr>' . "\n"; echo ' </tr>' . "\n";
@@ -1467,13 +1467,13 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
echo ' <tbody>' . "\n"; echo ' <tbody>' . "\n";
$odd_row = true; $odd_row = true;
$index_checkbox = -1; $index_checkbox = -1;
foreach ( $db_rights as $user ) { foreach ($db_rights as $user) {
$index_checkbox++; $index_checkbox++;
ksort( $user ); ksort($user);
foreach ( $user as $host ) { foreach ($user as $host) {
$index_checkbox++; $index_checkbox++;
echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n" echo ' <tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n"
. ' <td><input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_' . $index_checkbox . '" value="' . str_replace( chr(27), '&#27;', htmlentities($host['User'] . $user_host_separator . $host['Host'] ) ) . '"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' /></td>' . "\n" . ' <td><input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_' . $index_checkbox . '" value="' . str_replace(chr(27), '&#27;', htmlentities($host['User'] . $user_host_separator . $host['Host'])) . '"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' /></td>' . "\n"
. ' <td><label for="checkbox_sel_users_' . $index_checkbox . '">' . (empty($host['User']) ? '<span style="color: #FF0000">' . $GLOBALS['strAny'] . '</span>' : htmlspecialchars($host['User'])) . '</label></td>' . "\n" . ' <td><label for="checkbox_sel_users_' . $index_checkbox . '">' . (empty($host['User']) ? '<span style="color: #FF0000">' . $GLOBALS['strAny'] . '</span>' : htmlspecialchars($host['User'])) . '</label></td>' . "\n"
. ' <td>' . htmlspecialchars($host['Host']) . '</td>' . "\n"; . ' <td>' . htmlspecialchars($host['Host']) . '</td>' . "\n";
echo ' <td>'; echo ' <td>';
@@ -1491,41 +1491,41 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
} // end switch } // end switch
echo '</td>' . "\n" echo '</td>' . "\n"
. ' <td><tt>' . "\n" . ' <td><tt>' . "\n"
. ' ' . implode( ',' . "\n" . ' ', $host['privs'] ) . "\n" . ' ' . implode(',' . "\n" . ' ', $host['privs']) . "\n"
. ' </tt></td>' . "\n" . ' </tt></td>' . "\n"
. ' <td>' . ($host['Grant_priv'] == 'Y' ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n" . ' <td>' . ($host['Grant_priv'] == 'Y' ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n"
. ' <td align="center">'; . ' <td align="center">';
printf( $link_edit, urlencode( $host['User'] ), printf($link_edit, urlencode($host['User']),
urlencode( $host['Host'] ), '', '' ); urlencode($host['Host']), '', '');
echo '</td>' . "\n" echo '</td>' . "\n"
. ' </tr>' . "\n"; . ' </tr>' . "\n";
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
} }
} }
unset( $user, $host, $odd_row ); unset($user, $host, $odd_row);
echo ' </tbody></table>' . "\n" echo ' </tbody></table>' . "\n"
.'<img class="selectallarrow"' .'<img class="selectallarrow"'
.' src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"' .' src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"'
.' width="38" height="22"' .' width="38" height="22"'
.' alt="' . $GLOBALS['strWithChecked'] . '" />' . "\n" .' alt="' . $GLOBALS['strWithChecked'] . '" />' . "\n"
.'<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;checkall=1"' .'<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;checkall=1"'
.' onclick="if ( markAllRows(\'usersForm\') ) return false;">' .' onclick="if (markAllRows(\'usersForm\')) return false;">'
. $GLOBALS['strCheckAll'] . '</a>' . "\n" . $GLOBALS['strCheckAll'] . '</a>' . "\n"
.'/' . "\n" .'/' . "\n"
.'<a href="server_privileges.php?' . $GLOBALS['url_query'] . '"' .'<a href="server_privileges.php?' . $GLOBALS['url_query'] . '"'
.' onclick="if ( unMarkAllRows(\'usersForm\') ) return false;">' .' onclick="if (unMarkAllRows(\'usersForm\')) return false;">'
. $GLOBALS['strUncheckAll'] . '</a>' . "\n"; . $GLOBALS['strUncheckAll'] . '</a>' . "\n";
// add/delete user fieldset // add/delete user fieldset
echo ' <fieldset id="fieldset_add_user">' . "\n" echo ' <fieldset id="fieldset_add_user">' . "\n"
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1">' . "\n" . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1">' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' . "\n" : '' ) . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' . "\n" : '')
. ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n" . ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n"
. ' </fieldset>' . "\n" . ' </fieldset>' . "\n"
. ' <fieldset id="fieldset_delete_user">' . ' <fieldset id="fieldset_delete_user">'
. ' <legend>' . "\n" . ' <legend>' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usrdrop.png" width="16" height="16" alt="" />' . "\n" : '' ) . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usrdrop.png" width="16" height="16" alt="" />' . "\n" : '')
. ' ' . $GLOBALS['strRemoveSelectedUsers'] . '' . "\n" . ' ' . $GLOBALS['strRemoveSelectedUsers'] . '' . "\n"
. ' </legend>' . "\n"; . ' </legend>' . "\n";
@@ -1548,7 +1548,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
. ' </label><br />' . "\n"; . ' </label><br />' . "\n";
} else { } else {
echo ' <input type="hidden" name="mode" value="2" />' . "\n" echo ' <input type="hidden" name="mode" value="2" />' . "\n"
. '( ' . $GLOBALS['strRevokeAndDelete'] . ' )<br />' . "\n"; . '(' . $GLOBALS['strRevokeAndDelete'] . ')<br />' . "\n";
} }
echo ' <input type="checkbox" title="' . $GLOBALS['strDropUsersDb'] . '" name="drop_users_db" id="checkbox_drop_users_db" />' . "\n" echo ' <input type="checkbox" title="' . $GLOBALS['strDropUsersDb'] . '" name="drop_users_db" id="checkbox_drop_users_db" />' . "\n"
@@ -1564,7 +1564,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
unset ($row); unset ($row);
echo ' <fieldset id="fieldset_add_user">' . "\n" echo ' <fieldset id="fieldset_add_user">' . "\n"
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1">' . "\n" . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1">' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' . "\n" : '' ) . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' . "\n" : '')
. ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n" . ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n"
. ' </fieldset>' . "\n"; . ' </fieldset>' . "\n";
} // end if (display overview) } // end if (display overview)
@@ -1580,27 +1580,27 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
// A user was selected -> display the user's properties // A user was selected -> display the user's properties
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usredit.png" width="16" height="16" alt="" />' : '' ) . ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usredit.png" width="16" height="16" alt="" />' : '')
. $GLOBALS['strUser'] . ' <i><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;username=' . urlencode($username) . '&amp;hostname=' . urlencode($hostname) . '">\'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname) . '\'</a></i>' . "\n"; . $GLOBALS['strUser'] . ' <i><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;username=' . urlencode($username) . '&amp;hostname=' . urlencode($hostname) . '">\'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname) . '\'</a></i>' . "\n";
if ( isset( $dbname ) && strlen($dbname) ) { if (isset($dbname) && strlen($dbname)) {
if ( $dbname_is_wildcard ) { if ($dbname_is_wildcard) {
echo ' - ' . $GLOBALS['strDatabases']; echo ' - ' . $GLOBALS['strDatabases'];
} else { } else {
echo ' - ' . $GLOBALS['strDatabase']; echo ' - ' . $GLOBALS['strDatabase'];
} }
$url_dbname = urlencode(str_replace('\_', '_', $dbname)); $url_dbname = urlencode(str_replace('\_', '_', $dbname));
echo ' <i><a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . $url_dbname . '&amp;reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n"; echo ' <i><a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . $url_dbname . '&amp;reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n";
if ( isset( $tablename ) && strlen($tablename) ) { if (isset($tablename) && strlen($tablename)) {
echo ' - ' . $GLOBALS['strTable'] . ' <i><a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . $url_dbname . '&amp;table=' . urlencode($tablename) . '&amp;reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n"; echo ' - ' . $GLOBALS['strTable'] . ' <i><a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . $url_dbname . '&amp;table=' . urlencode($tablename) . '&amp;reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n";
} }
unset($url_dbname); unset($url_dbname);
} }
echo ' : ' . $GLOBALS['strEditPrivileges'] . '</h2>' . "\n"; echo ' : ' . $GLOBALS['strEditPrivileges'] . '</h2>' . "\n";
$res = PMA_DBI_query('SELECT \'foo\' FROM `mysql`.`user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';', null, PMA_DBI_QUERY_STORE); $res = PMA_DBI_query('SELECT \'foo\' FROM `mysql`.`user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';', null, PMA_DBI_QUERY_STORE);
$user_does_not_exists = (PMA_DBI_num_rows( $res ) < 1); $user_does_not_exists = (PMA_DBI_num_rows($res) < 1);
PMA_DBI_free_result($res); PMA_DBI_free_result($res);
unset($res); unset($res);
if ( $user_does_not_exists ) { if ($user_does_not_exists) {
echo $GLOBALS['strUserNotFound']; echo $GLOBALS['strUserNotFound'];
PMA_displayLoginInformationFields(); PMA_displayLoginInformationFields();
//require_once './libraries/footer.inc.php'; //require_once './libraries/footer.inc.php';
@@ -1609,18 +1609,18 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
. PMA_generate_common_hidden_inputs('', '', 3) . PMA_generate_common_hidden_inputs('', '', 3)
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
. '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"; . '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n";
if ( isset( $dbname ) && strlen($dbname) ) { if (isset($dbname) && strlen($dbname)) {
echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n"; echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
if ( isset( $tablename ) && strlen($tablename) ) { if (isset($tablename) && strlen($tablename)) {
echo ' <input type="hidden" name="tablename" value="' . htmlspecialchars($tablename) . '" />' . "\n"; echo ' <input type="hidden" name="tablename" value="' . htmlspecialchars($tablename) . '" />' . "\n";
} }
} }
PMA_displayPrivTable((( ! isset( $dbname ) || ! strlen($dbname) ) ? '*' : $dbname), PMA_displayPrivTable(((! isset($dbname) || ! strlen($dbname)) ? '*' : $dbname),
((( ! isset( $dbname ) || ! strlen($dbname) ) || ( ! isset( $tablename ) || ! strlen($tablename) )) ? '*' : $tablename), (((! isset($dbname) || ! strlen($dbname)) || (! isset($tablename) || ! strlen($tablename))) ? '*' : $tablename),
TRUE, 3); TRUE, 3);
echo '</form>' . "\n"; echo '</form>' . "\n";
if ( ( ! isset( $tablename ) || ! strlen($tablename) ) && empty( $dbname_is_wildcard ) ) { if ((! isset($tablename) || ! strlen($tablename)) && empty($dbname_is_wildcard)) {
// no table name was given, display all table specific rights // no table name was given, display all table specific rights
// but only if $dbname contains no wildcards // but only if $dbname contains no wildcards
@@ -1631,13 +1631,13 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
. '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"
. '<fieldset>' . "\n" . '<fieldset>' . "\n"
. '<legend>' . (( ! isset( $dbname ) || ! strlen($dbname) ) ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges']) . '</legend>' . "\n" . '<legend>' . ((! isset($dbname) || ! strlen($dbname)) ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges']) . '</legend>' . "\n"
. '<table class="data">' . "\n" . '<table class="data">' . "\n"
. '<thead>' . "\n" . '<thead>' . "\n"
. '<tr><th>' . (( ! isset( $dbname ) || ! strlen($dbname) ) ? $GLOBALS['strDatabase'] : $GLOBALS['strTable']) . '</th>' . "\n" . '<tr><th>' . ((! isset($dbname) || ! strlen($dbname)) ? $GLOBALS['strDatabase'] : $GLOBALS['strTable']) . '</th>' . "\n"
. ' <th>' . $GLOBALS['strPrivileges'] . '</th>' . "\n" . ' <th>' . $GLOBALS['strPrivileges'] . '</th>' . "\n"
. ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n" . ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n"
. ' <th>' . (( ! isset( $dbname ) || ! strlen($dbname) ) ? $GLOBALS['strTblPrivileges'] : $GLOBALS['strColumnPrivileges']) . '</th>' . "\n" . ' <th>' . ((! isset($dbname) || ! strlen($dbname)) ? $GLOBALS['strTblPrivileges'] : $GLOBALS['strColumnPrivileges']) . '</th>' . "\n"
. ' <th colspan="2">' . $GLOBALS['strAction'] . '</th>' . "\n" . ' <th colspan="2">' . $GLOBALS['strAction'] . '</th>' . "\n"
. '</tr>' . "\n" . '</tr>' . "\n"
. '</thead>' . "\n" . '</thead>' . "\n"
@@ -1654,7 +1654,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
// we also want privielgs for this user not in table `db` but in other table // we also want privielgs for this user not in table `db` but in other table
$tables = PMA_DBI_fetch_result('SHOW TABLES FROM `mysql`;'); $tables = PMA_DBI_fetch_result('SHOW TABLES FROM `mysql`;');
if ( ( ! isset( $dbname ) || ! strlen($dbname) ) ) { if ((! isset($dbname) || ! strlen($dbname))) {
// no db name given, so we want all privs for the given user // no db name given, so we want all privs for the given user
@@ -1663,8 +1663,8 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
); );
$db_rights_sqls = array(); $db_rights_sqls = array();
foreach ( $tables_to_search_for_users as $table_search_in ) { foreach ($tables_to_search_for_users as $table_search_in) {
if ( in_array( $table_search_in, $tables ) ) { if (in_array($table_search_in, $tables)) {
$db_rights_sqls[] = ' $db_rights_sqls[] = '
SELECT DISTINCT `Db` SELECT DISTINCT `Db`
FROM `mysql`.`' . $table_search_in . '` FROM `mysql`.`' . $table_search_in . '`
@@ -1675,48 +1675,48 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
$user_defaults = array( $user_defaults = array(
'Db' => '', 'Db' => '',
'Grant_priv' => 'N', 'Grant_priv' => 'N',
'privs' => array( 'USAGE' ), 'privs' => array('USAGE'),
'Table_privs' => true, 'Table_privs' => true,
); );
// for the rights // for the rights
$db_rights = array(); $db_rights = array();
if ( PMA_MYSQL_INT_VERSION >= 40000 ) { if (PMA_MYSQL_INT_VERSION >= 40000) {
$db_rights_sql = '(' . implode( ') UNION (', $db_rights_sqls ) . ')' $db_rights_sql = '(' . implode(') UNION (', $db_rights_sqls) . ')'
.' ORDER BY `Db` ASC'; .' ORDER BY `Db` ASC';
$db_rights_result = PMA_DBI_query( $db_rights_sql ); $db_rights_result = PMA_DBI_query($db_rights_sql);
while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) {
$db_rights_row = array_merge( $user_defaults, $db_rights_row ); $db_rights_row = array_merge($user_defaults, $db_rights_row);
// only Db names in the table `mysql`.`db` uses wildcards // only Db names in the table `mysql`.`db` uses wildcards
// as we are in the db specific rights display we want // as we are in the db specific rights display we want
// all db names escaped, also from other sources // all db names escaped, also from other sources
$db_rights_row['Db'] = PMA_escape_mysql_wildcards( $db_rights_row['Db'] = PMA_escape_mysql_wildcards(
$db_rights_row['Db'] ); $db_rights_row['Db']);
$db_rights[$db_rights_row['Db']] = $db_rights_row; $db_rights[$db_rights_row['Db']] = $db_rights_row;
} }
} else { } else {
foreach ( $db_rights_sqls as $db_rights_sql ) { foreach ($db_rights_sqls as $db_rights_sql) {
$db_rights_result = PMA_DBI_query( $db_rights_sql ); $db_rights_result = PMA_DBI_query($db_rights_sql);
while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) {
$db_rights_row = array_merge( $user_defaults, $db_rights_row ); $db_rights_row = array_merge($user_defaults, $db_rights_row);
$db_rights[$db_rights_row['Db']] = $db_rights_row; $db_rights[$db_rights_row['Db']] = $db_rights_row;
} }
} }
} }
PMA_DBI_free_result( $db_rights_result ); PMA_DBI_free_result($db_rights_result);
unset( $db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row ); unset($db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row);
$sql_query = 'SELECT * FROM `mysql`.`db`' . $user_host_condition . ' ORDER BY `Db` ASC'; $sql_query = 'SELECT * FROM `mysql`.`db`' . $user_host_condition . ' ORDER BY `Db` ASC';
$res = PMA_DBI_query( $sql_query ); $res = PMA_DBI_query($sql_query);
$sql_query = ''; $sql_query = '';
while ( $row = PMA_DBI_fetch_assoc( $res ) ) { while ($row = PMA_DBI_fetch_assoc($res)) {
if ( isset( $db_rights[$row['Db']] ) ) { if (isset($db_rights[$row['Db']])) {
$db_rights[$row['Db']] = array_merge( $db_rights[$row['Db']], $row ); $db_rights[$row['Db']] = array_merge($db_rights[$row['Db']], $row);
} else { } else {
$db_rights[$row['Db']] = $row; $db_rights[$row['Db']] = $row;
} }
@@ -1724,8 +1724,8 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
// so we can drop this db rights // so we can drop this db rights
$db_rights[$row['Db']]['can_delete'] = true; $db_rights[$row['Db']]['can_delete'] = true;
} }
PMA_DBI_free_result( $res ); PMA_DBI_free_result($res);
unset( $row, $res ); unset($row, $res);
} else { } else {
@@ -1734,15 +1734,15 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
$user_host_condition .= $user_host_condition .=
' AND ' . PMA_convert_using('`Db`') ' AND ' . PMA_convert_using('`Db`')
.' LIKE ' . PMA_convert_using( $dbname, 'quoted' ); .' LIKE ' . PMA_convert_using($dbname, 'quoted');
$tables_to_search_for_users = array( $tables_to_search_for_users = array(
'columns_priv', 'columns_priv',
); );
$db_rights_sqls = array(); $db_rights_sqls = array();
foreach ( $tables_to_search_for_users as $table_search_in ) { foreach ($tables_to_search_for_users as $table_search_in) {
if ( in_array( $table_search_in, $tables ) ) { if (in_array($table_search_in, $tables)) {
$db_rights_sqls[] = ' $db_rights_sqls[] = '
SELECT DISTINCT `Table_name` SELECT DISTINCT `Table_name`
FROM `mysql`.`' . $table_search_in . '` FROM `mysql`.`' . $table_search_in . '`
@@ -1753,35 +1753,35 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
$user_defaults = array( $user_defaults = array(
'Table_name' => '', 'Table_name' => '',
'Grant_priv' => 'N', 'Grant_priv' => 'N',
'privs' => array( 'USAGE' ), 'privs' => array('USAGE'),
'Column_priv' => true, 'Column_priv' => true,
); );
// for the rights // for the rights
$db_rights = array(); $db_rights = array();
if ( PMA_MYSQL_INT_VERSION >= 40000 ) { if (PMA_MYSQL_INT_VERSION >= 40000) {
$db_rights_sql = '(' . implode( ') UNION (', $db_rights_sqls ) . ')' $db_rights_sql = '(' . implode(') UNION (', $db_rights_sqls) . ')'
.' ORDER BY `Table_name` ASC'; .' ORDER BY `Table_name` ASC';
$db_rights_result = PMA_DBI_query( $db_rights_sql ); $db_rights_result = PMA_DBI_query($db_rights_sql);
while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) {
$db_rights_row = array_merge( $user_defaults, $db_rights_row ); $db_rights_row = array_merge($user_defaults, $db_rights_row);
$db_rights[$db_rights_row['Table_name']] = $db_rights_row; $db_rights[$db_rights_row['Table_name']] = $db_rights_row;
} }
} else { } else {
foreach ( $db_rights_sqls as $db_rights_sql ) { foreach ($db_rights_sqls as $db_rights_sql) {
$db_rights_result = PMA_DBI_query( $db_rights_sql ); $db_rights_result = PMA_DBI_query($db_rights_sql);
while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) {
$db_rights_row = array_merge( $user_defaults, $db_rights_row ); $db_rights_row = array_merge($user_defaults, $db_rights_row);
$db_rights[$db_rights_row['Table_name']] = $db_rights_row; $db_rights[$db_rights_row['Table_name']] = $db_rights_row;
} }
} }
} }
PMA_DBI_free_result( $db_rights_result ); PMA_DBI_free_result($db_rights_result);
unset( $db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row ); unset($db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row);
$sql_query = $sql_query =
'SELECT `Table_name`,' 'SELECT `Table_name`,'
@@ -1791,58 +1791,58 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
.' FROM `mysql`.`tables_priv`' .' FROM `mysql`.`tables_priv`'
. $user_host_condition . $user_host_condition
.' ORDER BY `Table_name` ASC;'; .' ORDER BY `Table_name` ASC;';
$res = PMA_DBI_query( $sql_query ); $res = PMA_DBI_query($sql_query);
$sql_query = ''; $sql_query = '';
while ( $row = PMA_DBI_fetch_assoc( $res ) ) { while ($row = PMA_DBI_fetch_assoc($res)) {
if ( isset( $db_rights[$row['Table_name']] ) ) { if (isset($db_rights[$row['Table_name']])) {
$db_rights[$row['Table_name']] = array_merge( $db_rights[$row['Table_name']], $row ); $db_rights[$row['Table_name']] = array_merge($db_rights[$row['Table_name']], $row);
} else { } else {
$db_rights[$row['Table_name']] = $row; $db_rights[$row['Table_name']] = $row;
} }
} }
PMA_DBI_free_result( $res ); PMA_DBI_free_result($res);
unset( $row, $res ); unset($row, $res);
} }
ksort( $db_rights ); ksort($db_rights);
// display rows // display rows
if ( count( $db_rights ) < 1 ) { if (count($db_rights) < 1) {
echo '<tr class="odd">' . "\n" echo '<tr class="odd">' . "\n"
. ' <td colspan="6"><center><i>' . $GLOBALS['strNone'] . '</i></center></td>' . "\n" . ' <td colspan="6"><center><i>' . $GLOBALS['strNone'] . '</i></center></td>' . "\n"
. '</tr>' . "\n"; . '</tr>' . "\n";
} else { } else {
$odd_row = true; $odd_row = true;
$found_rows = array(); $found_rows = array();
//while ( $row = PMA_DBI_fetch_assoc( $res ) ) { //while ($row = PMA_DBI_fetch_assoc($res)) {
foreach ( $db_rights as $row ) { foreach ($db_rights as $row) {
$found_rows[] = ( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $row['Table_name']; $found_rows[] = (! isset($dbname) || ! strlen($dbname)) ? $row['Db'] : $row['Table_name'];
echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n" echo '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n"
. ' <td>' . htmlspecialchars(( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $row['Table_name']) . '</td>' . "\n" . ' <td>' . htmlspecialchars((! isset($dbname) || ! strlen($dbname)) ? $row['Db'] : $row['Table_name']) . '</td>' . "\n"
. ' <td><tt>' . "\n" . ' <td><tt>' . "\n"
. ' ' . join(',' . "\n" . ' ', PMA_extractPrivInfo($row, TRUE)) . "\n" . ' ' . join(',' . "\n" . ' ', PMA_extractPrivInfo($row, TRUE)) . "\n"
. ' </tt></td>' . "\n" . ' </tt></td>' . "\n"
. ' <td>' . (((( ! isset( $dbname ) || ! strlen($dbname) ) && $row['Grant_priv'] == 'Y') || (isset($dbname) && strlen($dbname) && in_array('Grant', explode(',', $row['Table_priv'])))) ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n" . ' <td>' . ((((! isset($dbname) || ! strlen($dbname)) && $row['Grant_priv'] == 'Y') || (isset($dbname) && strlen($dbname) && in_array('Grant', explode(',', $row['Table_priv'])))) ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n"
. ' <td>'; . ' <td>';
if ( ! empty( $row['Table_privs'] ) || ! empty ( $row['Column_priv'] ) ) { if (! empty($row['Table_privs']) || ! empty ($row['Column_priv'])) {
echo $GLOBALS['strYes']; echo $GLOBALS['strYes'];
} else { } else {
echo $GLOBALS['strNo']; echo $GLOBALS['strNo'];
} }
echo '</td>' . "\n" echo '</td>' . "\n"
. ' <td>'; . ' <td>';
printf( $link_edit, urlencode( $username ), printf($link_edit, urlencode($username),
urlencode( $hostname ), urlencode($hostname),
urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $dbname ), urlencode((! isset($dbname) || ! strlen($dbname)) ? $row['Db'] : $dbname),
urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? '' : $row['Table_name'] ) ); urlencode((! isset($dbname) || ! strlen($dbname)) ? '' : $row['Table_name']));
echo '</td>' . "\n" echo '</td>' . "\n"
. ' <td>'; . ' <td>';
if ( ! empty( $row['can_delete'] ) || isset( $row['Table_name'] ) && strlen($row['Table_name']) ) { if (! empty($row['can_delete']) || isset($row['Table_name']) && strlen($row['Table_name'])) {
printf( $link_revoke, urlencode( $username ), printf($link_revoke, urlencode($username),
urlencode( $hostname ), urlencode($hostname),
urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $dbname ), urlencode((! isset($dbname) || ! strlen($dbname)) ? $row['Db'] : $dbname),
urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? '' : $row['Table_name'] ) ); urlencode((! isset($dbname) || ! strlen($dbname)) ? '' : $row['Table_name']));
} }
echo '</td>' . "\n" echo '</td>' . "\n"
. '</tr>' . "\n"; . '</tr>' . "\n";
@@ -1853,16 +1853,16 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
echo '</tbody>' . "\n" echo '</tbody>' . "\n"
. '</table>' . "\n"; . '</table>' . "\n";
if ( ! isset( $dbname ) || ! strlen($dbname) ) { if (! isset($dbname) || ! strlen($dbname)) {
// no database name was give, display select db // no database name was give, display select db
if ( ! empty( $found_rows ) ) { if (! empty($found_rows)) {
$pred_db_array = array_diff( $pred_db_array = array_diff(
PMA_DBI_fetch_result( 'SHOW DATABASES;' ), PMA_DBI_fetch_result('SHOW DATABASES;'),
$found_rows ); $found_rows);
} else { } else {
$pred_db_array =PMA_DBI_fetch_result( 'SHOW DATABASES;' ); $pred_db_array =PMA_DBI_fetch_result('SHOW DATABASES;');
} }
echo ' <label for="text_dbname">' . $GLOBALS['strAddPrivilegesOnDb'] . ':</label>' . "\n"; echo ' <label for="text_dbname">' . $GLOBALS['strAddPrivilegesOnDb'] . ':</label>' . "\n";
@@ -1870,14 +1870,14 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
echo ' <select name="pred_dbname" onchange="this.form.submit();">' . "\n" echo ' <select name="pred_dbname" onchange="this.form.submit();">' . "\n"
. ' <option value="" selected="selected">' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"; . ' <option value="" selected="selected">' . $GLOBALS['strUseTextField'] . ':</option>' . "\n";
foreach ($pred_db_array as $current_db) { foreach ($pred_db_array as $current_db) {
$current_db = PMA_escape_mysql_wildcards( $current_db ); $current_db = PMA_escape_mysql_wildcards($current_db);
echo ' <option value="' . htmlspecialchars( $current_db ) . '">' echo ' <option value="' . htmlspecialchars($current_db) . '">'
. htmlspecialchars( $current_db ) . '</option>' . "\n"; . htmlspecialchars($current_db) . '</option>' . "\n";
} }
echo ' </select>' . "\n"; echo ' </select>' . "\n";
} }
echo ' <input type="text" id="text_dbname" name="dbname" />' . "\n" echo ' <input type="text" id="text_dbname" name="dbname" />' . "\n"
.PMA_showHint( $GLOBALS['strEscapeWildcards'] ); .PMA_showHint($GLOBALS['strEscapeWildcards']);
} else { } else {
echo ' <input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '"/>' . "\n" echo ' <input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '"/>' . "\n"
. ' <label for="text_tablename">' . $GLOBALS['strAddPrivilegesOnTbl'] . ':</label>' . "\n"; . ' <label for="text_tablename">' . $GLOBALS['strAddPrivilegesOnTbl'] . ':</label>' . "\n";
@@ -1889,7 +1889,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
} }
} }
PMA_DBI_free_result($res); PMA_DBI_free_result($res);
unset( $res, $row ); unset($res, $row);
if (!empty($pred_tbl_array)) { if (!empty($pred_tbl_array)) {
echo ' <select name="pred_tablename" onchange="this.form.submit();">' . "\n" echo ' <select name="pred_tablename" onchange="this.form.submit();">' . "\n"
. ' <option value="" selected="selected">' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"; . ' <option value="" selected="selected">' . $GLOBALS['strUseTextField'] . ':</option>' . "\n";
@@ -1910,7 +1910,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
. '</form>' . "\n"; . '</form>' . "\n";
} }
if ( ( ! isset( $dbname ) || ! strlen($dbname) ) && ! $user_does_not_exists ) { if ((! isset($dbname) || ! strlen($dbname)) && ! $user_does_not_exists) {
echo '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n" echo '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n"
. PMA_generate_common_hidden_inputs('', '', 3) . PMA_generate_common_hidden_inputs('', '', 3)
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
@@ -1944,7 +1944,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
. '<input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"
. '<fieldset id="fieldset_change_copy_user">' . "\n" . '<fieldset id="fieldset_change_copy_user">' . "\n"
. ' <legend>' . $GLOBALS['strChangeCopyUser'] . '</legend>' . "\n"; . ' <legend>' . $GLOBALS['strChangeCopyUser'] . '</legend>' . "\n";
PMA_displayLoginInformationFields('change', 3 ); PMA_displayLoginInformationFields('change', 3);
echo ' <fieldset>' . "\n" echo ' <fieldset>' . "\n"
. ' <legend>' . $GLOBALS['strChangeCopyMode'] . '</legend>' . "\n" . ' <legend>' . $GLOBALS['strChangeCopyMode'] . '</legend>' . "\n"
. ' <input type="radio" name="mode" value="4" id="radio_mode_4" checked="checked" /><label for="radio_mode_4">' . "\n" . ' <input type="radio" name="mode" value="4" id="radio_mode_4" checked="checked" /><label for="radio_mode_4">' . "\n"
@@ -1971,7 +1971,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
// Add a new user // Add a new user
$GLOBALS['url_query'] .= '&amp;adduser=1'; $GLOBALS['url_query'] .= '&amp;adduser=1';
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' : '' ) . ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' : '')
. ' ' . $GLOBALS['strAddUser'] . "\n" . ' ' . $GLOBALS['strAddUser'] . "\n"
. '</h2>' . "\n" . '</h2>' . "\n"
. '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post" onsubmit="return checkAddUser(this);">' . "\n" . '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post" onsubmit="return checkAddUser(this);">' . "\n"
@@ -2001,7 +2001,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
// check the privileges for a particular database. // check the privileges for a particular database.
echo '<table id="tablespecificuserrights" class="data">' . "\n" echo '<table id="tablespecificuserrights" class="data">' . "\n"
. '<caption class="tblHeaders">' . "\n" . '<caption class="tblHeaders">' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usrcheck.png" width="16" height="16" alt="" />' . "\n" : '' ) . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usrcheck.png" width="16" height="16" alt="" />' . "\n" : '')
. ' ' . sprintf($GLOBALS['strUsersHavingAccessToDb'], '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n" . ' ' . sprintf($GLOBALS['strUsersHavingAccessToDb'], '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n"
. '</caption>' . "\n" . '</caption>' . "\n"
. '<thead>' . "\n" . '<thead>' . "\n"
@@ -2051,7 +2051,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
. PMA_convert_using('`Db`') . ' AS `Db`, ' . PMA_convert_using('`Db`') . ' AS `Db`, '
. $list_of_privileges . $list_of_privileges
.' FROM `mysql`.`db`' .' FROM `mysql`.`db`'
.' WHERE ' . PMA_convert_using( $checkprivs, 'quoted' ) .' WHERE ' . PMA_convert_using($checkprivs, 'quoted')
.' LIKE ' . PMA_convert_using('`Db`') .' LIKE ' . PMA_convert_using('`Db`')
.' AND NOT (' . $list_of_compared_privileges. ')) ' .' AND NOT (' . $list_of_compared_privileges. ')) '
.'UNION ' .'UNION '
@@ -2121,7 +2121,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
$row2 = PMA_DBI_fetch_assoc($res2); $row2 = PMA_DBI_fetch_assoc($res2);
} }
} }
echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n" echo ' <tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n"
. ' <td'; . ' <td';
if (count($current_privileges) > 1) { if (count($current_privileges) > 1) {
echo ' rowspan="' . count($current_privileges) . '"'; echo ' rowspan="' . count($current_privileges) . '"';
@@ -2138,7 +2138,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
. ' '; . ' ';
if (!isset($current['Db']) || $current['Db'] == '*') { if (!isset($current['Db']) || $current['Db'] == '*') {
echo $GLOBALS['strGlobal']; echo $GLOBALS['strGlobal'];
} elseif ( $current['Db'] == PMA_escape_mysql_wildcards( $checkprivs ) ) { } elseif ($current['Db'] == PMA_escape_mysql_wildcards($checkprivs)) {
echo $GLOBALS['strDbSpecific']; echo $GLOBALS['strDbSpecific'];
} else { } else {
echo $GLOBALS['strWildcard'], ': <tt>' . htmlspecialchars($current['Db']) . '</tt>'; echo $GLOBALS['strWildcard'], ': <tt>' . htmlspecialchars($current['Db']) . '</tt>';
@@ -2154,10 +2154,10 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
. ' ' . ($current['Grant_priv'] == 'Y' ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . "\n" . ' ' . ($current['Grant_priv'] == 'Y' ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . "\n"
. ' </td>' . "\n" . ' </td>' . "\n"
. ' <td>' . "\n"; . ' <td>' . "\n";
printf( $link_edit, urlencode( $current_user ), printf($link_edit, urlencode($current_user),
urlencode( $current_host ), urlencode($current_host),
urlencode( ! isset( $current['Db'] ) || $current['Db'] == '*' ? '' : $current['Db'] ), urlencode(! isset($current['Db']) || $current['Db'] == '*' ? '' : $current['Db']),
'' ); '');
echo '</td>' . "\n" echo '</td>' . "\n"
. ' </tr>' . "\n"; . ' </tr>' . "\n";
} }

View File

@@ -38,7 +38,7 @@ require './libraries/server_links.inc.php';
* Displays the sub-page heading * Displays the sub-page heading
*/ */
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_process.png" width="16" height="16" alt="" />' : '' ) . ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_process.png" width="16" height="16" alt="" />' : '')
. $strProcesslist . "\n" . $strProcesslist . "\n"
. '</h2>' . "\n"; . '</h2>' . "\n";
@@ -46,10 +46,10 @@ echo '<h2>' . "\n"
/** /**
* Sends the query * Sends the query
*/ */
$sql_query = 'SHOW' . ( empty( $full ) ? '' : ' FULL' ) . ' PROCESSLIST'; $sql_query = 'SHOW' . (empty($full) ? '' : ' FULL') . ' PROCESSLIST';
$result = PMA_DBI_query($sql_query); $result = PMA_DBI_query($sql_query);
PMA_showMessage( $GLOBALS['strSuccess'] ); PMA_showMessage($GLOBALS['strSuccess']);
/** /**
@@ -83,7 +83,7 @@ while($process = PMA_DBI_fetch_assoc($result)) {
<td class="value"><?php echo $process['Id']; ?></td> <td class="value"><?php echo $process['Id']; ?></td>
<td><?php echo $process['User']; ?></td> <td><?php echo $process['User']; ?></td>
<td><?php echo $process['Host']; ?></td> <td><?php echo $process['Host']; ?></td>
<td><?php echo (( ! isset( $process['db'] ) || ! strlen($process['db']) ) ? '<i>' . $strNone . '</i>' : $process['db']); ?></td> <td><?php echo ((! isset($process['db']) || ! strlen($process['db'])) ? '<i>' . $strNone . '</i>' : $process['db']); ?></td>
<td><?php echo $process['Command']; ?></td> <td><?php echo $process['Command']; ?></td>
<td class="value"><?php echo $process['Time']; ?></td> <td class="value"><?php echo $process['Time']; ?></td>
<td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td> <td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td>

View File

@@ -8,8 +8,8 @@
/** /**
* *
*/ */
if ( ! defined( 'PMA_NO_VARIABLES_IMPORT' ) ) { if (! defined('PMA_NO_VARIABLES_IMPORT')) {
define( 'PMA_NO_VARIABLES_IMPORT', true ); define('PMA_NO_VARIABLES_IMPORT', true);
} }
require_once './libraries/common.inc.php'; require_once './libraries/common.inc.php';
@@ -29,7 +29,7 @@ require './libraries/server_links.inc.php';
* Displays the sub-page heading * Displays the sub-page heading
*/ */
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_vars.png" width="16" height="16" alt="" />' : '' ) . ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_vars.png" width="16" height="16" alt="" />' : '')
. '' . $strServerVars . "\n" . '' . $strServerVars . "\n"
. '</h2>' . "\n"; . '</h2>' . "\n";

View File

@@ -199,8 +199,8 @@ if ($abort == FALSE) {
$show_create_table = PMA_DBI_fetch_value( $show_create_table = PMA_DBI_fetch_value(
'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
0, 1 ); 0, 1);
$analyzed_sql = PMA_SQP_analyze( PMA_SQP_parse( $show_create_table ) ); $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
require './libraries/tbl_properties.inc.php'; require './libraries/tbl_properties.inc.php';
} }

View File

@@ -126,8 +126,8 @@ require_once './libraries/tbl_links.inc.php';
*/ */
$show_create_table = PMA_DBI_fetch_value( $show_create_table = PMA_DBI_fetch_value(
'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
0, 1 ); 0, 1);
$analyzed_sql = PMA_SQP_analyze( PMA_SQP_parse( $show_create_table ) ); $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
unset($show_create_table); unset($show_create_table);
/** /**
@@ -366,9 +366,9 @@ foreach ($loop_array as $vrowcount => $vrow) {
// Note: (tested in MySQL 4.0.16): when lang is some UTF-8, // Note: (tested in MySQL 4.0.16): when lang is some UTF-8,
// $row_table_def['Default'] is not set if it contains NULL: // $row_table_def['Default'] is not set if it contains NULL:
// Array ( [Field] => d [Type] => datetime [Null] => YES [Key] => [Extra] => [True_Type] => datetime ) // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Extra] => [True_Type] => datetime)
// but, look what we get if we switch to iso: (Default is NULL) // but, look what we get if we switch to iso: (Default is NULL)
// Array ( [Field] => d [Type] => datetime [Null] => YES [Key] => [Default] => [Extra] => [True_Type] => datetime ) // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Default] => [Extra] => [True_Type] => datetime)
// so I force a NULL into it (I don't think it's possible // so I force a NULL into it (I don't think it's possible
// to have an empty default value for DATETIME) // to have an empty default value for DATETIME)
// then, the "if" after this one will work // then, the "if" after this one will work
@@ -533,7 +533,7 @@ foreach ($loop_array as $vrowcount => $vrow) {
// Is current function defined as default? // Is current function defined as default?
// For MySQL < 4.1.2, for the first timestamp we set as // For MySQL < 4.1.2, for the first timestamp we set as
// default function the one defined in config (which // default function the one defined in config (which
// should be NOW() ). // should be NOW()).
// For MySQL >= 4.1.2, we don't set the default function // For MySQL >= 4.1.2, we don't set the default function
// if there is a default value for the timestamp // if there is a default value for the timestamp
// (not including CURRENT_TIMESTAMP) // (not including CURRENT_TIMESTAMP)
@@ -596,7 +596,7 @@ foreach ($loop_array as $vrowcount => $vrow) {
} }
echo ' />' . "\n"; echo ' />' . "\n";
if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary)) ) { if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary))) {
echo ' <input type="checkbox" tabindex="' . ($tabindex + $tabindex_for_null) . '"' echo ' <input type="checkbox" tabindex="' . ($tabindex + $tabindex_for_null) . '"'
. ' name="fields_null' . $field_name_appendix . '"'; . ' name="fields_null' . $field_name_appendix . '"';
@@ -915,7 +915,7 @@ foreach ($loop_array as $vrowcount => $vrow) {
echo '</td>'; echo '</td>';
} // end elseif ( binary or blob) } // end elseif (binary or blob)
else { else {
// field size should be at least 4 and max 40 // field size should be at least 4 and max 40
$fieldsize = min(max($len, 4), 40); $fieldsize = min(max($len, 4), 40);

View File

@@ -56,7 +56,7 @@ if (! empty($sql_query)) {
$wheres[] = $analyzed_sql[0]['where_clause']; $wheres[] = $analyzed_sql[0]['where_clause'];
} }
if (count($wheres) > 0 ) { if (count($wheres) > 0) {
$sql_query .= ' WHERE (' . implode(') AND (', $wheres) . ')'; $sql_query .= ' WHERE (' . implode(') AND (', $wheres) . ')';
} }

View File

@@ -23,8 +23,8 @@ if (!defined('PMA_IDX_INCLUDED')) {
$is_db = PMA_DBI_select_db($db); $is_db = PMA_DBI_select_db($db);
} }
if (!strlen($db) || !$is_db) { if (!strlen($db) || !$is_db) {
$uri_params = array( 'reload' => '1' ); $uri_params = array('reload' => '1');
if ( isset($message) ) { if (isset($message)) {
$uri_params['message'] = $message; $uri_params['message'] = $message;
} }
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php' PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php'
@@ -32,21 +32,21 @@ if (!defined('PMA_IDX_INCLUDED')) {
exit; exit;
} }
// Not a valid table name -> back to the default db sub-page // Not a valid table name -> back to the default db sub-page
if (strlen($table) ) { if (strlen($table)) {
$is_table = PMA_DBI_query('SHOW TABLES LIKE \'' $is_table = PMA_DBI_query('SHOW TABLES LIKE \''
. PMA_sqlAddslashes($table, TRUE) . '\'', null, PMA_DBI_QUERY_STORE); . PMA_sqlAddslashes($table, TRUE) . '\'', null, PMA_DBI_QUERY_STORE);
} }
if (! strlen($table) if (! strlen($table)
|| !( $is_table && PMA_DBI_num_rows($is_table) ) ) { || !($is_table && PMA_DBI_num_rows($is_table))) {
$uri_params = array( 'reload' => '1', 'db' => $db ); $uri_params = array('reload' => '1', 'db' => $db);
if ( isset($message) ) { if (isset($message)) {
$uri_params['message'] = $message; $uri_params['message'] = $message;
} }
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] PMA_sendHeaderLocation($cfg['PmaAbsoluteUri']
. $cfg['DefaultTabDatabase'] . $cfg['DefaultTabDatabase']
. PMA_generate_common_url($uri_params, '&')); . PMA_generate_common_url($uri_params, '&'));
exit; exit;
} elseif ( isset($is_table) ) { } elseif (isset($is_table)) {
PMA_DBI_free_result($is_table); PMA_DBI_free_result($is_table);
} }
@@ -347,7 +347,7 @@ elseif (!defined('PMA_IDX_INCLUDED')
. '<option value="' . htmlspecialchars($val) . '"' . '<option value="' . htmlspecialchars($val) . '"'
. (($val == $selected) ? ' selected="selected"' : '') . '>' . (($val == $selected) ? ' selected="selected"' : '') . '>'
. htmlspecialchars($val) . (($add_type) ? ' [' . htmlspecialchars($val) . (($add_type) ? ' ['
. $fields_types[$key] . ']' : '' ) . '</option>' . "\n"; . $fields_types[$key] . ']' : '') . '</option>' . "\n";
} }
} // end foreach $fields_names } // end foreach $fields_names
?> ?>
@@ -393,7 +393,7 @@ elseif (!defined('PMA_IDX_INCLUDED')
'<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidColumnCount']); ?>', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidColumnCount']); ?>',
1)"> 1)">
<?php <?php
echo PMA_generate_common_hidden_inputs( $db, $table ); echo PMA_generate_common_hidden_inputs($db, $table);
?> ?>
<table id="table_indexes" class="data"> <table id="table_indexes" class="data">
<caption class="tblHeaders"> <caption class="tblHeaders">

View File

@@ -256,7 +256,7 @@ foreach ($the_tables as $key => $table) {
if ($have_rel) { if ($have_rel) {
echo ' <td>'; echo ' <td>';
if (isset($res_rel[$field_name])) { if (isset($res_rel[$field_name])) {
echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'] ); echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']);
} }
echo '&nbsp;</td>' . "\n"; echo '&nbsp;</td>' . "\n";
} }
@@ -288,9 +288,8 @@ foreach ($the_tables as $key => $table) {
<?php <?php
if ( ! $tbl_is_view if (! $tbl_is_view
&& ( $db != 'information_schema' && ($db != 'information_schema' || PMA_MYSQL_INT_VERSION < 50002)) {
|| PMA_MYSQL_INT_VERSION < 50002 ) ) {
/** /**
* Displays indexes * Displays indexes

View File

@@ -124,7 +124,7 @@ if (isset($destination) && $cfgRelation['relwork']) {
} // end if (updates for internal relations) } // end if (updates for internal relations)
// u p d a t e s f o r I n n o D B // u p d a t e s f o r I n n o D B
// ( for now, one index name only; we keep the definitions if the // (for now, one index name only; we keep the definitions if the
// foreign db is not the same) // foreign db is not the same)
// I use $sql_query to be able to display directly the query via // I use $sql_query to be able to display directly the query via
// PMA_showMessage() // PMA_showMessage()
@@ -142,7 +142,7 @@ if (isset($_REQUEST['destination_innodb'])) {
// could be put in an include file // could be put in an include file
// Note: I tried to enclose the db and table name with // Note: I tried to enclose the db and table name with
// backquotes but MySQL 4.0.16 did not like the syntax // backquotes but MySQL 4.0.16 did not like the syntax
// (for example: `base2`.`table1` ) // (for example: `base2`.`table1`)
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) $sql_query = 'ALTER TABLE ' . PMA_backquote($table)
. ' ADD FOREIGN KEY (' . ' ADD FOREIGN KEY ('
@@ -163,8 +163,8 @@ if (isset($_REQUEST['destination_innodb'])) {
// end repeated code // end repeated code
} elseif (($existrel_innodb[$master_field]['foreign_db'] . '.' .$existrel_innodb[$master_field]['foreign_table'] . '.' . $existrel_innodb[$master_field]['foreign_field'] != $foreign_string) } elseif (($existrel_innodb[$master_field]['foreign_db'] . '.' .$existrel_innodb[$master_field]['foreign_table'] . '.' . $existrel_innodb[$master_field]['foreign_field'] != $foreign_string)
|| ( $_REQUEST['on_delete'][$master_field] != (!empty($existrel_innodb[$master_field]['on_delete']) ? $existrel_innodb[$master_field]['on_delete'] : '')) || ($_REQUEST['on_delete'][$master_field] != (!empty($existrel_innodb[$master_field]['on_delete']) ? $existrel_innodb[$master_field]['on_delete'] : ''))
|| ( $_REQUEST['on_update'][$master_field] != (!empty($existrel_innodb[$master_field]['on_update']) ? $existrel_innodb[$master_field]['on_update'] : '')) || ($_REQUEST['on_update'][$master_field] != (!empty($existrel_innodb[$master_field]['on_update']) ? $existrel_innodb[$master_field]['on_update'] : ''))
) { ) {
// another foreign key is already defined for this field // another foreign key is already defined for this field
// or // or
@@ -400,14 +400,14 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
<table> <table>
<tr><th></th> <tr><th></th>
<?php <?php
if ( $cfgRelation['relwork'] ) { if ($cfgRelation['relwork']) {
echo '<th>' . $strInternalRelations; echo '<th>' . $strInternalRelations;
if ($tbl_type=='INNODB') { if ($tbl_type=='INNODB') {
echo PMA_showHint( $strInternalNotNecessary ); echo PMA_showHint($strInternalNotNecessary);
} }
echo '</th>'; echo '</th>';
} }
if ( $tbl_type=='INNODB' ) { if ($tbl_type=='INNODB') {
echo '<th colspan="2">InnoDB'; echo '<th colspan="2">InnoDB';
if (PMA_MYSQL_INT_VERSION < 40013) { if (PMA_MYSQL_INT_VERSION < 40013) {
echo '(**)'; echo '(**)';
@@ -506,7 +506,7 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
PMA_generate_dropdown('ON DELETE', PMA_generate_dropdown('ON DELETE',
'on_delete[' . htmlspecialchars($save_row[$i]['Field']) . ']', 'on_delete[' . htmlspecialchars($save_row[$i]['Field']) . ']',
$options_array, $options_array,
isset($existrel_innodb[$myfield]['on_delete']) ? $existrel_innodb[$myfield]['on_delete']: '' ); isset($existrel_innodb[$myfield]['on_delete']) ? $existrel_innodb[$myfield]['on_delete']: '');
echo '</span>' . "\n" echo '</span>' . "\n"
.'<span class="formelement">' . "\n"; .'<span class="formelement">' . "\n";
@@ -514,7 +514,7 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
PMA_generate_dropdown('ON UPDATE', PMA_generate_dropdown('ON UPDATE',
'on_update[' . htmlspecialchars($save_row[$i]['Field']) . ']', 'on_update[' . htmlspecialchars($save_row[$i]['Field']) . ']',
$options_array, $options_array,
isset($existrel_innodb[$myfield]['on_update']) ? $existrel_innodb[$myfield]['on_update']: '' ); isset($existrel_innodb[$myfield]['on_update']) ? $existrel_innodb[$myfield]['on_update']: '');
echo '</span>' . "\n"; echo '</span>' . "\n";
} else { } else {
echo $strNoIndex; echo $strNoIndex;
@@ -558,7 +558,7 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
<?php <?php
} // end if (we have columns in this table) } // end if (we have columns in this table)
if ( $tbl_type === 'INNODB' && PMA_MYSQL_INT_VERSION < 40013 ) { if ($tbl_type === 'INNODB' && PMA_MYSQL_INT_VERSION < 40013) {
echo '<div class="warning">' echo '<div class="warning">'
.'** ' . sprintf($strUpgrade, 'MySQL', '4.0.13') .'** ' . sprintf($strUpgrade, 'MySQL', '4.0.13')
.'</div>'; .'</div>';

View File

@@ -12,7 +12,7 @@ require_once './libraries/common.inc.php';
require_once './libraries/relation.lib.php'; // foreign keys require_once './libraries/relation.lib.php'; // foreign keys
require_once './libraries/mysql_charsets.lib.php'; require_once './libraries/mysql_charsets.lib.php';
if ( $GLOBALS['cfg']['PropertiesIconic'] == true ) { if ($GLOBALS['cfg']['PropertiesIconic'] == true) {
$titles['Browse'] = $titles['Browse'] =
'<img class="icon" width="16" height="16" src="' . $pmaThemeImage '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
.'b_browse.png" alt="' . $strBrowseForeignValues . '" title="' .'b_browse.png" alt="' . $strBrowseForeignValues . '" title="'
@@ -99,7 +99,7 @@ if (!isset($param) || $param[0] == '') {
function PMA_tbl_select_operator(f, index, multiple) { function PMA_tbl_select_operator(f, index, multiple) {
switch (f.elements["func[" + index + "]"].options[f.elements["func[" + index + "]"].selectedIndex].value) { switch (f.elements["func[" + index + "]"].options[f.elements["func[" + index + "]"].selectedIndex].value) {
<?php <?php
reset( $GLOBALS['cfg']['UnaryOperators'] ); reset($GLOBALS['cfg']['UnaryOperators']);
while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) { while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) {
echo ' case "' . $operator . "\":\r\n"; echo ' case "' . $operator . "\":\r\n";
} }
@@ -127,10 +127,10 @@ while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) {
multiple="multiple"> multiple="multiple">
<?php <?php
// Displays the list of the fields // Displays the list of the fields
foreach ( $fields_list as $each_field ) { foreach ($fields_list as $each_field) {
echo ' ' echo ' '
.'<option value="' . htmlspecialchars( $each_field ) . '"' .'<option value="' . htmlspecialchars($each_field) . '"'
.' selected="selected">' . htmlspecialchars( $each_field ) .' selected="selected">' . htmlspecialchars($each_field)
.'</option>' . "\n"; .'</option>' . "\n";
} }
?> ?>
@@ -150,10 +150,10 @@ while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) {
<select name="orderField" style="vertical-align: middle"> <select name="orderField" style="vertical-align: middle">
<option value="--nil--"></option> <option value="--nil--"></option>
<?php <?php
foreach ( $fields_list as $each_field ) { foreach ($fields_list as $each_field) {
echo ' ' echo ' '
.'<option value="' . htmlspecialchars( $each_field ) . '">' .'<option value="' . htmlspecialchars($each_field) . '">'
.htmlspecialchars( $each_field ) . '</option>' . "\n"; .htmlspecialchars($each_field) . '</option>' . "\n";
} // end for } // end for
?> ?>
</select> </select>
@@ -334,9 +334,9 @@ else {
if (count($param) == $max_number_of_fields) { if (count($param) == $max_number_of_fields) {
$sql_query .= '* '; $sql_query .= '* ';
} else { } else {
$param = PMA_backquote( $param ); $param = PMA_backquote($param);
$sql_query .= implode( ', ', $param ); $sql_query .= implode(', ', $param);
unset( $param ); unset($param);
} // end if } // end if
$sql_query .= ' FROM ' . PMA_backquote($table); $sql_query .= ' FROM ' . PMA_backquote($table);

View File

@@ -377,10 +377,10 @@ div.notice {
margin: 0.5em 0 0.5em 0; margin: 0.5em 0 0.5em 0;
border: 0.1em solid #FFD700; border: 0.1em solid #FFD700;
width: 90%; width: 90%;
<?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?>
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_notice.png); background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_notice.png);
background-repeat: no-repeat; background-repeat: no-repeat;
<?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 10px 50%; background-position: 10px 50%;
padding: 10px 10px 10px 36px; padding: 10px 10px 10px 36px;
<?php } else { ?> <?php } else { ?>
@@ -408,10 +408,10 @@ div.warning {
margin: 0.5em 0 0.5em 0; margin: 0.5em 0 0.5em 0;
border: 0.1em solid #CC0000; border: 0.1em solid #CC0000;
width: 90%; width: 90%;
<?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?>
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_warn.png); background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_warn.png);
background-repeat: no-repeat; background-repeat: no-repeat;
<?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 10px 50%; background-position: 10px 50%;
padding: 10px 10px 10px 36px; padding: 10px 10px 10px 36px;
<?php } else { ?> <?php } else { ?>
@@ -439,10 +439,10 @@ div.error {
margin: 0.5em 0 0.5em 0; margin: 0.5em 0 0.5em 0;
border: 0.1em solid #ff0000; border: 0.1em solid #ff0000;
width: 90%; width: 90%;
<?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?>
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_error.png); background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_error.png);
background-repeat: no-repeat; background-repeat: no-repeat;
<?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 10px 50%; background-position: 10px 50%;
padding: 10px 10px 10px 36px; padding: 10px 10px 10px 36px;
<?php } else { ?> <?php } else { ?>
@@ -470,10 +470,10 @@ fieldset.confirmation legend {
border-left: 0.1em solid #FF0000; border-left: 0.1em solid #FF0000;
border-right: 0.1em solid #FF0000; border-right: 0.1em solid #FF0000;
font-weight: bold; font-weight: bold;
<?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?>
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_really.png); background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_really.png);
background-repeat: no-repeat; background-repeat: no-repeat;
<?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 5px 50%; background-position: 5px 50%;
padding: 0.2em 0.2em 0.2em 25px; padding: 0.2em 0.2em 0.2em 25px;
<?php } else { ?> <?php } else { ?>
@@ -619,7 +619,7 @@ a.tabcaution:hover {
background-color: #FF0000; background-color: #FF0000;
} }
<?php if ( $GLOBALS['cfg']['LightTabs'] ) { ?> <?php if ($GLOBALS['cfg']['LightTabs']) { ?>
/* active tab */ /* active tab */
a.tabactive { a.tabactive {
color: black; color: black;

View File

@@ -74,7 +74,7 @@ ul#databaseList {
border-bottom: 0.05em solid <?php echo $GLOBALS['cfg']['NaviColor']; ?>; border-bottom: 0.05em solid <?php echo $GLOBALS['cfg']['NaviColor']; ?>;
margin-bottom: 0.5em; margin-bottom: 0.5em;
padding-bottom: 0.5em; padding-bottom: 0.5em;
padding-left: 1.5em; padding-left: 1.5em;
} }
ul#databaseList a { ul#databaseList a {
@@ -165,7 +165,7 @@ div#left_tableList > ul li.marked {
} }
<?php } ?> <?php } ?>
<?php if ( $GLOBALS['cfg']['LeftPointerEnable'] ) { ?> <?php if ($GLOBALS['cfg']['LeftPointerEnable']) { ?>
div#left_tableList > ul li:hover > a, div#left_tableList > ul li:hover > a,
div#left_tableList > ul li:hover { div#left_tableList > ul li:hover {
background: <?php echo $GLOBALS['cfg']['NaviPointerBackground']; ?>; background: <?php echo $GLOBALS['cfg']['NaviPointerBackground']; ?>;

View File

@@ -352,10 +352,10 @@ h1.notice,
div.notice { div.notice {
margin: 0.5em 0 0.5em 0; margin: 0.5em 0 0.5em 0;
border: 0.1em solid #FFD700; border: 0.1em solid #FFD700;
<?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?>
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_notice.png); background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_notice.png);
background-repeat: no-repeat; background-repeat: no-repeat;
<?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 10px 50%; background-position: 10px 50%;
padding: 10px 10px 10px 36px; padding: 10px 10px 10px 36px;
<?php } else { ?> <?php } else { ?>
@@ -382,10 +382,10 @@ h1.warning,
div.warning { div.warning {
margin: 0.5em 0 0.5em 0; margin: 0.5em 0 0.5em 0;
border: 0.1em solid #CC0000; border: 0.1em solid #CC0000;
<?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?>
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_warn.png); background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_warn.png);
background-repeat: no-repeat; background-repeat: no-repeat;
<?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 10px 50%; background-position: 10px 50%;
padding: 10px 10px 10px 36px; padding: 10px 10px 10px 36px;
<?php } else { ?> <?php } else { ?>
@@ -412,10 +412,10 @@ h1.error,
div.error { div.error {
margin: 0.5em 0 0.5em 0; margin: 0.5em 0 0.5em 0;
border: 0.1em solid #ff0000; border: 0.1em solid #ff0000;
<?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?>
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_error.png); background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_error.png);
background-repeat: no-repeat; background-repeat: no-repeat;
<?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 10px 50%; background-position: 10px 50%;
padding: 10px 10px 10px 36px; padding: 10px 10px 10px 36px;
<?php } else { ?> <?php } else { ?>
@@ -443,10 +443,10 @@ fieldset.confirmation legend {
border-left: 0.1em solid #FF0000; border-left: 0.1em solid #FF0000;
border-right: 0.1em solid #FF0000; border-right: 0.1em solid #FF0000;
font-weight: bold; font-weight: bold;
<?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?>
background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_really.png); background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_really.png);
background-repeat: no-repeat; background-repeat: no-repeat;
<?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> <?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
background-position: 5px 50%; background-position: 5px 50%;
padding: 0.2em 0.2em 0.2em 25px; padding: 0.2em 0.2em 0.2em 25px;
<?php } else { ?> <?php } else { ?>
@@ -591,7 +591,7 @@ a.tabcaution:hover {
background-color: #FF0000; background-color: #FF0000;
} }
<?php if ( $GLOBALS['cfg']['LightTabs'] ) { ?> <?php if ($GLOBALS['cfg']['LightTabs']) { ?>
/* active tab */ /* active tab */
a.tabactive { a.tabactive {
color: black; color: black;

View File

@@ -79,8 +79,8 @@ if (!isset($resize)) {
// it sets $resize to jpeg or png // it sets $resize to jpeg or png
$srcImage = imagecreatefromstring($row[urldecode($transform_key)]); $srcImage = imagecreatefromstring($row[urldecode($transform_key)]);
$srcWidth = ImageSX( $srcImage ); $srcWidth = ImageSX($srcImage);
$srcHeight = ImageSY( $srcImage ); $srcHeight = ImageSY($srcImage);
// Check to see if the width > height or if width < height // Check to see if the width > height or if width < height
// if so adjust accordingly to make sure the image // if so adjust accordingly to make sure the image
@@ -98,21 +98,21 @@ if (!isset($resize)) {
} }
if ($resize) { if ($resize) {
$destImage = ImageCreateTrueColor( $destWidth, $destHeight); $destImage = ImageCreateTrueColor($destWidth, $destHeight);
} }
// ImageCopyResized( $destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight ); // ImageCopyResized($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight);
// better quality but slower: // better quality but slower:
ImageCopyResampled( $destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight ); ImageCopyResampled($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight);
if ($resize == 'jpeg') { if ($resize == 'jpeg') {
ImageJPEG( $destImage, '', 75 ); ImageJPEG($destImage, '', 75);
} }
if ($resize == 'png') { if ($resize == 'png') {
ImagePNG( $destImage); ImagePNG($destImage);
} }
ImageDestroy( $srcImage ); ImageDestroy($srcImage);
ImageDestroy( $destImage ); ImageDestroy($destImage);
} }
/** /**

View File

@@ -32,7 +32,7 @@ if (isset($_POST['submitoptions'])) {
$create_query .= ' VIEW ' . $_POST['view_name'] . $sep; $create_query .= ' VIEW ' . $_POST['view_name'] . $sep;
if (!empty($_POST['column_names'])) { if (!empty($_POST['column_names'])) {
$create_query .= ' ( ' . $_POST['column_names'] . ')' . $sep; $create_query .= ' (' . $_POST['column_names'] . ')' . $sep;
} }
$create_query .= ' AS ' . $_POST['sql_statement'] . $sep; $create_query .= ' AS ' . $_POST['sql_statement'] . $sep;