bugs 1248577 (incorrect message 'you should define a primary key') and 1253125 (request-URI too large)

This commit is contained in:
Marc Delisle
2005-08-14 19:31:55 +00:00
parent cd75266da0
commit 80aecf6518
5 changed files with 276 additions and 205 deletions

View File

@@ -8,6 +8,9 @@ $Source$
2005-08-14 Marc Delisle <lem9@users.sourceforge.net> 2005-08-14 Marc Delisle <lem9@users.sourceforge.net>
* tbl_change.php: $goto was not encoded in the form, resulting in a * tbl_change.php: $goto was not encoded in the form, resulting in a
problem after editing/saving a row (seen in IE6) problem after editing/saving a row (seen in IE6)
* libraries/common.lib.php, /display_tbl.lib.php, /functions.js, /grab_globals.lib.php:
patch #1257955 for bug #1248577 (incorrect message "you should define a primary key")
and bug #1253125 (request URI too large), thanks to Sebastian Mendel
2005-08-12 Marc Delisle <lem9@users.sourceforge.net> 2005-08-12 Marc Delisle <lem9@users.sourceforge.net>
* header.inc.php: remove the 'InnoDB free' segment from table comments * header.inc.php: remove the 'InnoDB free' segment from table comments

View File

@@ -1799,13 +1799,14 @@ if (typeof(document.getElementById) != 'undefined'
$onclick = ''; $onclick = '';
if ($cfg['QueryFrameJS'] && $cfg['QueryFrame']) { if ($cfg['QueryFrameJS'] && $cfg['QueryFrame']) {
$onclick = 'onclick="focus_querywindow(\'' . urlencode($local_query) . '\'); return false;"'; $onclick = 'focus_querywindow(\'' . urlencode($local_query) . '\'); return false;';
} }
$edit_link = '&nbsp;[<a href="' $edit_link = $edit_target
. $edit_target
. $url_qpart . $url_qpart
. '&amp;sql_query=' . urlencode($local_query) . '&amp;show_query=1#querybox" ' . $onclick . '>' . $GLOBALS['strEdit'] . '</a>]'; . '&amp;sql_query=' . urlencode($local_query)
. '&amp;show_query=1#querybox"';
$edit_link = ' [' . PMA_linkOrButton( $edit_link, $GLOBALS['strEdit'], array( 'onclick' => $onclick ) ) . ']';
} else { } else {
$edit_link = ''; $edit_link = '';
} }
@@ -1824,20 +1825,22 @@ if (typeof(document.getElementById) != 'undefined'
$explain_link_validate = ''; $explain_link_validate = '';
} }
$explain_link = '&nbsp;[<a href="read_dump.php' $explain_link = 'read_dump.php'
. $url_qpart . $url_qpart
. $explain_link_validate . $explain_link_validate
. '&amp;sql_query='; . '&amp;sql_query=';
if (preg_match('@^SELECT[[:space:]]+@i', $local_query)) { if (preg_match('@^SELECT[[:space:]]+@i', $local_query)) {
$explain_link .= urlencode('EXPLAIN ' . $local_query) . '">' . $GLOBALS['strExplain']; $explain_link .= urlencode('EXPLAIN ' . $local_query);
$message = $GLOBALS['strExplain'];
} else if (preg_match('@^EXPLAIN[[:space:]]+SELECT[[:space:]]+@i', $local_query)) { } else if (preg_match('@^EXPLAIN[[:space:]]+SELECT[[:space:]]+@i', $local_query)) {
$explain_link .= urlencode(substr($local_query, 8)) . '">' . $GLOBALS['strNoExplain']; $explain_link .= urlencode(substr($local_query, 8));
$message = $GLOBALS['strNoExplain'];
} else { } else {
$explain_link = ''; $explain_link = '';
} }
if (!empty($explain_link)) { if (!empty($explain_link)) {
$explain_link .= '</a>]'; $explain_link = ' [' . PMA_linkOrButton( $explain_link, $message ) . ']';
} }
} else { } else {
$explain_link = ''; $explain_link = '';
@@ -1847,25 +1850,28 @@ if (typeof(document.getElementById) != 'undefined'
// php-code (Mike Beck 2002-05-22) // php-code (Mike Beck 2002-05-22)
if (isset($cfg['SQLQuery']['ShowAsPHP']) if (isset($cfg['SQLQuery']['ShowAsPHP'])
&& $cfg['SQLQuery']['ShowAsPHP'] == TRUE) { && $cfg['SQLQuery']['ShowAsPHP'] == TRUE) {
$php_link = '&nbsp;[<a href="read_dump.php' $php_link = 'read_dump.php'
. $url_qpart . $url_qpart
. '&amp;show_query=1' . '&amp;show_query=1'
. '&amp;sql_query=' . urlencode($local_query) . '&amp;sql_query=' . urlencode($local_query)
. '&amp;show_as_php='; . '&amp;show_as_php=';
if (!empty($GLOBALS['show_as_php'])) { if (!empty($GLOBALS['show_as_php'])) {
$php_link .= '0">' . $GLOBALS['strNoPhp']; $php_link .= '0';
$message = $GLOBALS['strNoPhp'];
} else { } else {
$php_link .= '1">' . $GLOBALS['strPhp']; $php_link .= '1';
$message = $GLOBALS['strPhp'];
} }
$php_link .= '</a>]'; $php_link = ' [' . PMA_linkOrButton( $php_link, $message ) . ']';
if (isset($GLOBALS['show_as_php']) && $GLOBALS['show_as_php'] == '1') { if (isset($GLOBALS['show_as_php']) && $GLOBALS['show_as_php'] == '1') {
$php_link .= '&nbsp;[<a href="read_dump.php' $runquery_link
. $url_qpart = 'read_dump.php'
. '&amp;show_query=1' . $url_qpart
. '&amp;sql_query=' . urlencode($local_query) . '&amp;show_query=1'
. '">' . $GLOBALS['strRunQuery'] . '</a>]'; . '&amp;sql_query=' . urlencode($local_query);
$php_link .= ' [' . PMA_linkOrButton( $runquery_link, $GLOBALS['strRunQuery'] ) . ']';
} }
} else { } else {
@@ -1877,13 +1883,11 @@ if (typeof(document.getElementById) != 'undefined'
&& $cfg['SQLQuery']['Refresh'] && $cfg['SQLQuery']['Refresh']
&& preg_match('@^(SELECT|SHOW)[[:space:]]+@i', $local_query)) { && preg_match('@^(SELECT|SHOW)[[:space:]]+@i', $local_query)) {
$refresh_link = '&nbsp;[<a href="read_dump.php' $refresh_link = 'read_dump.php'
. $url_qpart . $url_qpart
. '&amp;show_query=1' . '&amp;show_query=1'
. '&amp;sql_query=' . urlencode($local_query) . '&amp;sql_query=' . urlencode($local_query);
. '">'; $refresh_link = ' [' . PMA_linkOrButton( $refresh_link, $GLOBALS['strRefresh'] ) . ']';
$refresh_link .= $GLOBALS['strRefresh'];
$refresh_link .= '</a>]';
} else { } else {
$refresh_link = ''; $refresh_link = '';
} //show as php } //show as php
@@ -1892,17 +1896,19 @@ if (typeof(document.getElementById) != 'undefined'
&& $cfg['SQLValidator']['use'] == TRUE && $cfg['SQLValidator']['use'] == TRUE
&& isset($cfg['SQLQuery']['Validate']) && isset($cfg['SQLQuery']['Validate'])
&& $cfg['SQLQuery']['Validate'] == TRUE) { && $cfg['SQLQuery']['Validate'] == TRUE) {
$validate_link = '&nbsp;[<a href="read_dump.php' $validate_link = 'read_dump.php'
. $url_qpart . $url_qpart
. '&amp;show_query=1' . '&amp;show_query=1'
. '&amp;sql_query=' . urlencode($local_query) . '&amp;sql_query=' . urlencode($local_query)
. '&amp;validatequery='; . '&amp;validatequery=';
if (!empty($GLOBALS['validatequery'])) { if (!empty($GLOBALS['validatequery'])) {
$validate_link .= '0">' . $GLOBALS['strNoValidateSQL'] ; $validate_link .= '0';
$message = $GLOBALS['strNoValidateSQL'] ;
} else { } else {
$validate_link .= '1">'. $GLOBALS['strValidateSQL'] ; $validate_link .= '1';
$message = $GLOBALS['strValidateSQL'] ;
} }
$validate_link .= '</a>]'; $validate_link = ' [' . PMA_linkOrButton( $validate_link, $GLOBALS['strRefresh'] ) . ']';
} else { } else {
$validate_link = ''; $validate_link = '';
} //validator } //validator
@@ -2144,52 +2150,96 @@ if (typeof(document.getElementById) != 'undefined'
* *
* @param string the URL * @param string the URL
* @param string the link message * @param string the link message
* @param string js confirmation * @param mixed $tag_params string: js confirmation
* @param boolean we set this to FALSE when we are already in a form, * array: additional tag params (f.e. style="")
* to avoid generating nested forms * @param boolean $new_form we set this to FALSE when we are already in
* a form, to avoid generating nested forms
* *
* @return string the results to be echoed or saved in an array * @return string the results to be echoed or saved in an array
*/ */
function PMA_linkOrButton($url, $message, $js_conf, $allow_button = TRUE, $strip_img = FALSE, $target = '') function PMA_linkOrButton($url, $message, $tag_params = array(), $new_form = TRUE, $strip_img = FALSE, $target = '')
{ {
if (!empty($target)) { if ( ! is_array( $tag_params ) )
$target = ' target="' . $target . '"'; {
$tmp = $tag_params;
$tag_params = array();
if ( ! empty( $tmp ) )
{
$tag_params['onclick'] = 'return confirmLink(this, \'' . $tmp . '\')';
}
unset( $tmp );
} }
if ( ! empty( $target ) ) {
$tag_params['target'] = htmlentities( $target );
}
$tag_params_strings = array();
foreach( $tag_params as $par_name => $par_value ) {
// htmlentities() only on non javascript
$par_value = substr( $par_name,0 ,2 ) == 'on' ? $par_value : htmlentities( $par_value );
$tag_params_strings[] = $par_name . '="' . $par_value . '"';
}
// previously the limit was set to 2047, it seems 1000 is better // previously the limit was set to 2047, it seems 1000 is better
if (strlen($url) <= 1000) { if (strlen($url) <= 1000) {
$onclick_url = (empty($js_conf) ? '' : ' onclick="return confirmLink(this, \'' . $js_conf . '\')"'); $ret = '<a href="' . $url . '" ' . implode( ' ', $tag_params_strings ) . '>' . "\n"
$link_or_button = ' <a href="' . $url . '"' . $onclick_url . $target . '>' . "\n" . ' ' . $message . '</a>' . "\n";
. ' ' . $message . '</a>' . "\n";
} }
elseif ($allow_button) { else {
$edit_url_parts = parse_url($url); // no spaces (linebreaks) at all
$query_parts = explode('&', $edit_url_parts['query']); // or after the hidden fields
$link_or_button = ' <form action="' // IE will display them all
. $edit_url_parts['path']
. '" method="post"' . $target . '>' . "\n"; // add class=link to submit button
if ( empty( $tag_params['class'] ) ) {
$tag_params['class'] = 'link';
}
$url = str_replace('&amp;', '&', $url);
$url_parts = parse_url($url);
$query_parts = explode('&', $url_parts['query']);
if ($new_form) {
$ret = '<form action="' . $url_parts['path'] . '" class="link"'
. ' method="post"' . $target . ' style="display: inline;">';
$subname_open = '';
$subname_close = '';
$submit_name = '';
} else {
$query_parts[] = 'redirect=' . $url_parts['path'];
if ( empty( $GLOBALS['subform_counter'] ) ) {
$GLOBALS['subform_counter'] = 0;
}
$GLOBALS['subform_counter']++;
$ret = '';
$subname_open = 'subform[' . $GLOBALS['subform_counter'] . '][';
$subname_close = ']';
$submit_name = ' name="usesubform[' . $GLOBALS['subform_counter'] . ']"';
}
foreach ($query_parts AS $query_pair) { foreach ($query_parts AS $query_pair) {
list($eachvar, $eachval) = explode('=', $query_pair); list($eachvar, $eachval) = explode('=', $query_pair);
$link_or_button .= ' <input type="hidden" name="' . str_replace('amp;', '', $eachvar) . '" value="' . htmlspecialchars(urldecode($eachval)) . '" />' . "\n"; $ret .= '<input type="hidden" name="' . $subname_open . $eachvar . $subname_close . '" value="' . htmlspecialchars(urldecode($eachval)) . '" />';
} // end while } // end while
if (stristr($message, '<img')) { if (stristr($message, '<img')) {
if ($strip_img) { if ($strip_img) {
$link_or_button .= ' <input type="submit" value="' $message = trim( strip_tags( $message ) );
. preg_replace('@<img[^>]*>@', '', $message) . '" />'; $ret .= '<input type="submit"' . $submit_name . ' ' . implode( ' ', $tag_params_strings )
. ' value="' . htmlspecialchars($message) . '" />';
} else { } else {
$link_or_button .= ' <input type="image" src="' . preg_replace('@^.*src="(.*)".*$@si', '\1', $message) . '" value="' $ret .= '<input type="image"' . $submit_name . ' ' . implode( ' ', $tag_params_strings )
. htmlspecialchars(preg_replace('@^.*alt="(.*)".*$@si', '\1', $message)) . '" />'; . ' src="' . preg_replace('<EFBFBD>^.*\ssrc="([^"]*)".*$<EFBFBD>si', '\1', $message) . '"'
. ' value="' . htmlspecialchars(preg_replace('<27>^.*\salt="([^"]*)".*$<24>si', '\1', $message)) . '" />';
} }
} else { } else {
$link_or_button .= ' <input type="submit" value="' $message = trim( strip_tags( $message ) );
. htmlspecialchars($message) . '" />'; $ret .= '<input type="submit"' . $submit_name . ' ' . implode( ' ', $tag_params_strings )
. ' value="' . htmlspecialchars($message) . '" />';
}
if ($new_form) {
$ret .= '</form>';
} }
$link_or_button .= "\n" . '</form>' . "\n";
} else {
$link_or_button = ' <dfn title="' . $GLOBALS['strNeedPrimaryKey'] . '">?</dfn> ';
} // end if... else... } // end if... else...
return $link_or_button; return $ret;
} // end of the 'PMA_linkOrButton()' function } // end of the 'PMA_linkOrButton()' function

View File

@@ -181,22 +181,24 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
* @param integer the offset for the "previous" page * @param integer the offset for the "previous" page
* @param string the url-encoded query * @param string the url-encoded query
* *
* @global string the current language * @global string $db the database name
* @global string the currect charset for MySQL * @global string $table the table name
* @global integer the server to use (refers to the number in the * @global string $goto the url to go back in case of errors
* configuration file) * @global boolean $dontlimitchars whether to limit the number of displayed
* @global string the database name * characters of text type fields or not
* @global string the table name * @global integer $num_rows the total number of rows returned by the
* @global string the url to go back in case of errors * sql query
* @global integer the total number of rows returned by the sql query * @global integer $unlim_num_rows the total number of rows returned by the
* @global integer the total number of rows returned by the sql query * sql any programmatically appended "LIMIT" clause
* without any programmatically appended "LIMIT" clause * @global integer $pos the current position in results
* @global integer the current position in results * @global mixed $session_max_rows the maximum number of rows per page
* @global mixed the maximum number of rows per page ('all' = no limit) * ('all' = no limit)
* @global string the display mode (horizontal/vertical/horizontalflipped) * @global string $disp_direction the display mode
* @global integer the number of row to display between two table headers * (horizontal / vertical / horizontalflipped)
* @global boolean whether to limit the number of displayed characters of * @global integer $repeat_cells the number of row to display between two
* text type fields or not * table headers
* @global boolean $is_innodb whether its InnoDB or not
* @global array $showtable table definitions
* *
* @access private * @access private
* *
@@ -204,11 +206,9 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
*/ */
function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query) function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query)
{ {
global $lang, $convcharset, $server, $db, $table; global $db, $table, $goto, $dontlimitchars;
global $goto;
global $num_rows, $unlim_num_rows, $pos, $session_max_rows; global $num_rows, $unlim_num_rows, $pos, $session_max_rows;
global $disp_direction, $repeat_cells; global $disp_direction, $repeat_cells;
global $dontlimitchars;
global $is_innodb; global $is_innodb;
global $showtable; global $showtable;
@@ -428,22 +428,22 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query)
* *
* @return boolean always true * @return boolean always true
* *
* @global string the current language * @global string $db the database name
* @global string the current charset for MySQL * @global string $table the table name
* @global integer the server to use (refers to the number in the * @global string $goto the url to go back in case of errors
* configuration file) * @global boolean $dontlimitchars whether to limit the number of displayed
* @global string the database name * characters of text type fields or not
* @global string the table name * @global string $sql_query the sql query
* @global string the sql query * @global integer $num_rows the total number of rows returned by the
* @global string the url to go back in case of errors * sql query
* @global integer the total number of rows returned by the sql query * @global integer $pos the current position in results
* @global integer the current position in results * @global integer $session_max_rows the maximum number of rows per page
* @global integer the maximum number of rows per page * @global array $vertical_display informations used with vertical display
* @global array informations used with vertical display mode * mode
* @global string the display mode (horizontal/vertical/horizontalflipped) * @global string $disp_direction the display mode
* @global integer the number of row to display between two table headers * (horizontal/vertical/horizontalflipped)
* @global boolean whether to limit the number of displayed characters of * @global integer $repeat_cellsthe number of row to display between two
* text type fields or not * table headers
* *
* @access private * @access private
* *
@@ -451,12 +451,10 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query)
*/ */
function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $analyzed_sql = '') function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $analyzed_sql = '')
{ {
global $lang, $convcharset, $server, $db, $table; global $db, $table, $goto, $dontlimitchars;
global $goto, $text_url;
global $sql_query, $num_rows, $pos, $session_max_rows; global $sql_query, $num_rows, $pos, $session_max_rows;
global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns; global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns;
global $dontlimitchars;
if ($analyzed_sql == '') { if ($analyzed_sql == '') {
$analyzed_sql = array(); $analyzed_sql = array();
} }
@@ -598,7 +596,6 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
<!-- Results table headers --> <!-- Results table headers -->
<tr> <tr>
<?php <?php
echo "\n";
} }
// 1. Displays the full/partial text button (part 1)... // 1. Displays the full/partial text button (part 1)...
@@ -621,6 +618,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
. '&amp;repeat_cells=' . $repeat_cells . '&amp;repeat_cells=' . $repeat_cells
. '&amp;goto=' . $goto . '&amp;goto=' . $goto
. '&amp;dontlimitchars=' . (($dontlimitchars) ? 0 : 1); . '&amp;dontlimitchars=' . (($dontlimitchars) ? 0 : 1);
$text_message = '<img src="' . $GLOBALS['pmaThemeImage'] . 's_'.($dontlimitchars ? 'partialtext' : 'fulltext') . '.png" border="0" width="50" height="20" alt="' . ($dontlimitchars ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" title="' . ($dontlimitchars ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" />';
$text_link = PMA_linkOrButton( $text_url, $text_message, array(), false );
// ... before the result table // ... before the result table
if (($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn') if (($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
@@ -629,8 +628,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
?> ?>
<th class="td" colspan="<?php echo $fields_cnt; ?>" align="center"> <th class="td" colspan="<?php echo $fields_cnt; ?>" align="center">
<a href="<?php echo $text_url; ?>"> <?php echo $text_link; ?>
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_'.(($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png'; ?>" border="0" width="50" height="20" alt="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" title="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" /></a>
</th> </th>
</tr> </tr>
@@ -642,8 +640,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
?> ?>
<tr> <tr>
<th class="td" colspan="<?php echo $num_rows + floor($num_rows/$repeat_cells) + 1; ?>" align="center"> <th class="td" colspan="<?php echo $num_rows + floor($num_rows/$repeat_cells) + 1; ?>" align="center">
<a href="<?php echo $text_url; ?>"> <?php echo $text_link; ?>
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . (($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png'; ?>" border="0" width="50" height="20" alt="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" title="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" /></a>
</th> </th>
</tr> </tr>
<?php <?php
@@ -658,15 +655,13 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
echo "\n"; echo "\n";
?> ?>
<th class="td" <?php echo $colspan; ?> align="center"> <th class="td" <?php echo $colspan; ?> align="center">
<a href="<?php echo $text_url; ?>"> <?php echo $text_link; ?>
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . (($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png'; ?>" border="0" width="50" height="20" alt="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" title="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" /></a>
</th> </th>
<?php <?php
} // end horizontal/horizontalflipped mode } // end horizontal/horizontalflipped mode
else { else {
$vertical_display['textbtn'] = ' <th class="td" ' . $rowspan . ' align="center" valign="middle">' . "\n" $vertical_display['textbtn'] = ' <th class="td" ' . $rowspan . ' align="center" valign="middle">' . "\n"
. ' <a href="' . $text_url . '">' . "\n" . ' ' . $text_link . "\n"
. ' <img src="' . $GLOBALS['pmaThemeImage'] . 's_' . (($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png" border="0" width="50" height="20" alt="' . (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" title="' . (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" /></a>' . "\n"
. ' </th>' . "\n"; . ' </th>' . "\n";
} // end vertical mode } // end vertical mode
} }
@@ -691,7 +686,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
// 2.0 If sorting links should be used, checks if the query is a "JOIN" // 2.0 If sorting links should be used, checks if the query is a "JOIN"
// statement (see 2.1.3) // statement (see 2.1.3)
// 2.0.1 Prepare Display column comments if enabled ($cfg['ShowBrowseComments']). // 2.0.1 Prepare Display column comments if enabled ($GLOBALS['cfg']['ShowBrowseComments']).
// Do not show comments, if using horizontalflipped mode, because of space usage // Do not show comments, if using horizontalflipped mode, because of space usage
if ($GLOBALS['cfg']['ShowBrowseComments'] && $GLOBALS['cfgRelation']['commwork'] && $disp_direction != 'horizontalflipped') { if ($GLOBALS['cfg']['ShowBrowseComments'] && $GLOBALS['cfgRelation']['commwork'] && $disp_direction != 'horizontalflipped') {
$comments_map = array(); $comments_map = array();
@@ -743,13 +738,9 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
if (isset($comments_map) && if (isset($comments_map) &&
isset($comments_map[$fields_meta[$i]->table]) && isset($comments_map[$fields_meta[$i]->table]) &&
isset($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name])) { isset($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name])) {
/*$comments_table_wrap_pre = '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><th>'; $comments = '<span class="tblcomment">' . htmlspecialchars($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name]) . '</span>';
$comments_table_wrap_post = '</th></tr><tr><th style="font-size: 8pt; font-weight: normal">' . htmlspecialchars($comments_map[$fields_meta[$i]->name]) . '</td></tr></table>';*/
$comments_table_wrap_pre = '';
$comments_table_wrap_post = '<span class="tblcomment">' . htmlspecialchars($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name]) . '</span>';
} else { } else {
$comments_table_wrap_pre = ''; $comments = '';
$comments_table_wrap_post = '';
} }
// 2.1 Results can be sorted // 2.1 Results can be sorted
@@ -797,23 +788,23 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
// 2.1.4 Do define the sorting url // 2.1.4 Do define the sorting url
if (!$is_in_sort) { if (!$is_in_sort) {
// loic1: patch #455484 ("Smart" order) // loic1: patch #455484 ("Smart" order)
$cfg['Order'] = strtoupper($GLOBALS['cfg']['Order']); $GLOBALS['cfg']['Order'] = strtoupper($GLOBALS['cfg']['Order']);
if ($cfg['Order'] == 'SMART') { if ($GLOBALS['cfg']['Order'] == 'SMART') {
$cfg['Order'] = (preg_match('@time|date@i', $fields_meta[$i]->type)) ? 'DESC' : 'ASC'; $GLOBALS['cfg']['Order'] = (preg_match('@time|date@i', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
} }
$sort_order .= $cfg['Order']; $sort_order .= $GLOBALS['cfg']['Order'];
$order_img = ''; $order_img = '';
} }
else if (preg_match('@[[:space:]]ASC$@i', $sort_expression)) { else if (preg_match('@[[:space:]]ASC$@i', $sort_expression)) {
$sort_order .= ' DESC'; $sort_order .= ' DESC';
$order_img = '&nbsp;<img src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="soimg' . $i . '" />'; $order_img = ' <img src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="soimg' . $i . '" />';
} }
else if (preg_match('@[[:space:]]DESC$@i', $sort_expression)) { else if (preg_match('@[[:space:]]DESC$@i', $sort_expression)) {
$sort_order .= ' ASC'; $sort_order .= ' ASC';
$order_img = '&nbsp;<img src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="soimg' . $i . '" />'; $order_img = ' <img src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="soimg' . $i . '" />';
} else { } else {
$sort_order .= ' DESC'; $sort_order .= ' DESC';
$order_img = '&nbsp;<img src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="soimg' . $i . '" />'; $order_img = ' <img src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="soimg' . $i . '" />';
} }
if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@i', $unsorted_sql_query, $regs3)) { if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@i', $unsorted_sql_query, $regs3)) {
@@ -828,48 +819,41 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
. '&amp;repeat_cells=' . $repeat_cells . '&amp;repeat_cells=' . $repeat_cells
. '&amp;dontlimitchars=' . $dontlimitchars . '&amp;dontlimitchars=' . $dontlimitchars
. '&amp;sql_query=' . urlencode($sorted_sql_query); . '&amp;sql_query=' . urlencode($sorted_sql_query);
$order_url = 'sql.php?' . $url_query;
// 2.1.5 Displays the sorting url // 2.1.5 Displays the sorting url
// added 20004-06-09: Michael Keck <mail@michaelkeck.de> // added 20004-06-09: Michael Keck <mail@michaelkeck.de>
// enable sord order swapping for image // enable sord order swapping for image
$order_onmouse = ''; $order_link_params = array();
if (isset($order_img) && $order_img!='') { if (isset($order_img) && $order_img!='') {
if (strstr($order_img,'asc')) { if (strstr($order_img,'asc')) {
$order_onmouse.= ' onmouseover="if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }"' $order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
.' onmouseout="if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }"'; $order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
} else if (strstr($order_img,'desc')) { } else if (strstr($order_img,'desc')) {
$order_onmouse.= ' onmouseover="if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }"' $order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
.' onmouseout="if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }"'; $order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
} }
} }
$order_link_pre = '<a href="sql.php?' . $url_query . '" ' . (($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css') ? 'style="direction: ltr; writing-mode: tb-rl;"' : '') . ' title="' . $GLOBALS['strSort'] . '"' . $order_onmouse . '>'; if ( $disp_direction == 'horizontalflipped'
$order_link_post = '</a>'; && $GLOBALS['cfg']['HeaderFlipType'] == 'css' ) {
$order_link_content = ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name)); $order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;';
$order_link_words = explode(' ', $order_link_content);
if (isset($order_link_words[1])) {
$order_last_word_index = count($order_link_words)-1;
$order_last_word = $order_link_words[$order_last_word_index];
unset($order_link_words[$order_last_word_index]);
$order_link = $order_link_pre . implode(' ', $order_link_words)
. ' <div class="nowrap">' . $order_last_word . $order_img . '</div>' . $order_link_post . "\n";
} else {
$order_link = '<div class="nowrap">' . $order_link_pre . $order_link_content . $order_link_post . $order_img . '</div>' . "\n";
} }
$order_link_params['title'] = $GLOBALS['strSort'];
$order_link_content = ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name));
$order_link = PMA_linkOrButton( $order_url, $order_link_content . $order_img, $order_link_params, false, true );
if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') { if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
echo "\n"; echo "\n";
?> ?>
<th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') echo 'valign="bottom"'; ?>> <th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') echo 'valign="bottom"'; ?>>
<?php echo $comments_table_wrap_pre; ?>
<?php echo $order_link; ?> <?php echo $order_link; ?>
<?php echo $comments_table_wrap_post; ?> <?php echo $comments; ?>
</th> </th>
<?php <?php
} }
$vertical_display['desc'][] = ' <th ' . $column_style . '>' . "\n" $vertical_display['desc'][] = ' <th ' . $column_style . '>' . "\n"
. $comments_table_wrap_pre
. $order_link . $order_link
. $comments_table_wrap_post . $comments
. ' </th>' . "\n"; . ' </th>' . "\n";
} // end if (2.1) } // end if (2.1)
@@ -879,16 +863,14 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
echo "\n"; echo "\n";
?> ?>
<th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') echo 'valign="bottom"'; ?> <?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css' ? 'style="direction: ltr; writing-mode: tb-rl;"' : ''); ?>> <th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') echo 'valign="bottom"'; ?> <?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css' ? 'style="direction: ltr; writing-mode: tb-rl;"' : ''); ?>>
<?php echo $comments_table_wrap_pre; ?>
<?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake'? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name)) . "\n"; ?> <?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake'? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name)) . "\n"; ?>
<?php echo $comments_table_wrap_post; ?> <?php echo $comments; ?>
</th> </th>
<?php <?php
} }
$vertical_display['desc'][] = ' <th ' . $column_style . '>' . "\n" $vertical_display['desc'][] = ' <th ' . $column_style . '>' . "\n"
. $comments_table_wrap_pre
. ' ' . htmlspecialchars($fields_meta[$i]->name) . "\n" . ' ' . htmlspecialchars($fields_meta[$i]->name) . "\n"
. $comments_table_wrap_post . $comments
. ' </th>'; . ' </th>';
} // end else (2.2) } // end else (2.2)
} // end for } // end for
@@ -903,15 +885,13 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
echo "\n"; echo "\n";
?> ?>
<th class="td" <?php echo $colspan; ?> align="center"> <th class="td" <?php echo $colspan; ?> align="center">
<a href="<?php echo $text_url; ?>"> <?php echo $text_link; ?>
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . (($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png'; ?>" border="0" width="50" height="20" alt="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" title="<?php echo (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']); ?>" /></a>
</th> </th>
<?php <?php
} // end horizontal/horizontalflipped mode } // end horizontal/horizontalflipped mode
else { else {
$vertical_display['textbtn'] = ' <th class="td" ' . $rowspan . ' align="center" valign="middle">' . "\n" $vertical_display['textbtn'] = ' <th class="td" ' . $rowspan . ' align="center" valign="middle">' . "\n"
. ' <a href="' . $text_url . '">' . "\n" . ' ' . $text_link . "\n"
. ' <img src="' . $GLOBALS['pmaThemeImage'] . 's_' . (($dontlimitchars) ? 'partialtext' : 'fulltext') . '.png" border="0" width="50" height="20" alt="' . (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" title="' . (($dontlimitchars) ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" /></a>' . "\n"
. ' </th>' . "\n"; . ' </th>' . "\n";
} // end vertical mode } // end vertical mode
} }
@@ -957,23 +937,25 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
* *
* @return boolean always true * @return boolean always true
* *
* @global string the current language * @global string $db the database name
* @global string the current charset for MySQL * @global string $table the table name
* @global integer the server to use (refers to the number in the * @global string $goto the url to go back in case of errors
* configuration file) * @global boolean $dontlimitchars whether to limit the number of displayed
* @global string the database name * characters of text type fields or not
* @global string the table name * @global string $sql_query the sql query
* @global string the sql query * @global integer $pos the current position in results
* @global string the url to go back in case of errors * @global integer $session_max_rows the maximum number of rows per page
* @global integer the current position in results * @global array $fields_meta the list of fields properties
* @global integer the maximum number of rows per page * @global integer $fields_cnt the total number of fields returned by
* @global array the list of fields properties * the sql query
* @global integer the total number of fields returned by the sql query * @global array $vertical_display informations used with vertical display
* @global array informations used with vertical display mode * mode
* @global string the display mode (horizontal/vertical/horizontalflipped) * @global string $disp_direction the display mode
* @global integer the number of row to display between two table headers * (horizontal/vertical/horizontalflipped)
* @global boolean whether to limit the number of displayed characters of * @global integer $repeat_cells the number of row to display between two
* text type fields or not * table headers
* @global array $highlight_columns collumn names to highlight
* @gloabl array $row current row data
* *
* @access private * @access private
* *
@@ -981,11 +963,9 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
*/ */
function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
{ {
global $lang, $convcharset, $server, $db, $table; global $db, $table, $goto, $dontlimitchars;
global $goto;
global $sql_query, $pos, $session_max_rows, $fields_meta, $fields_cnt; global $sql_query, $pos, $session_max_rows, $fields_meta, $fields_cnt;
global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns; global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns;
global $dontlimitchars;
global $row; // mostly because of browser transformations, to make the row-data accessible in a plugin global $row; // mostly because of browser transformations, to make the row-data accessible in a plugin
$url_sql_query = $sql_query; $url_sql_query = $sql_query;
@@ -1115,12 +1095,10 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
// 1.2.1 Modify link(s) // 1.2.1 Modify link(s)
if ($is_display['edit_lnk'] == 'ur') { // update row case if ($is_display['edit_lnk'] == 'ur') { // update row case
// $lnk_goto = 'sql.php' $lnk_goto = 'sql.php'
// . '?' . str_replace('&amp;', '&', $url_query) . '?' . str_replace('&amp;', '&', $url_query)
// . '&sql_query=' . urlencode($sql_query) . '&sql_query=' . urlencode($sql_query)
// . '&goto=' . (empty($goto) ? 'tbl_properties.php' : $goto); . '&goto=' . (empty($goto) ? 'tbl_properties.php' : $goto);
// to reduce the length of the URL, because of some browsers limitations:
$lnk_goto = 'sql.php';
$edit_url = 'tbl_change.php' $edit_url = 'tbl_change.php'
. '?' . $url_query . '?' . $url_query
@@ -1351,7 +1329,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
} else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && stristr($meta->type, 'BLOB')) { } else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && stristr($meta->type, 'BLOB')) {
// loic1 : PMA_mysql_fetch_fields returns BLOB in place of // loic1 : PMA_mysql_fetch_fields returns BLOB in place of
// TEXT fields type, however TEXT fields must be displayed // TEXT fields type, however TEXT fields must be displayed
// even if $cfg['ShowBlob'] is false -> get the true type // even if $GLOBALS['cfg']['ShowBlob'] is false -> get the true type
// of the fields. // of the fields.
$field_flags = PMA_DBI_field_flags($dt_result, $i); $field_flags = PMA_DBI_field_flags($dt_result, $i);
if (stristr($field_flags, 'BINARY')) { if (stristr($field_flags, 'BINARY')) {
@@ -1392,7 +1370,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
// loic1: support blanks in the key // loic1: support blanks in the key
$relation_id = $row[$i]; $relation_id = $row[$i];
// nijel: Cut all fields to $cfg['LimitChars'] // nijel: Cut all fields to $GLOBALS['cfg']['LimitChars']
if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) { if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) {
$row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...'; $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
} }
@@ -1524,7 +1502,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
if (isset($edit_url)) { if (isset($edit_url)) {
$vertical_display['edit'][$row_no] .= ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '"' . $column_style_vertical . '>' . "\n" $vertical_display['edit'][$row_no] .= ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '"' . $column_style_vertical . '>' . "\n"
. PMA_linkOrButton($edit_url, $edit_str, '', FALSE) . PMA_linkOrButton($edit_url, $edit_str, array(), FALSE)
. $bookmark_go . $bookmark_go
. ' </td>' . "\n"; . ' </td>' . "\n";
} else { } else {
@@ -1557,8 +1535,9 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
* *
* @return boolean always true * @return boolean always true
* *
* @global array the information to display * @global array $vertical_display the information to display
* @global integer the number of row to display between two table headers * @global integer $repeat_cells the number of row to display between two
* table headers
* *
* @access private * @access private
* *
@@ -1712,27 +1691,30 @@ function PMA_displayVerticalTable()
* @param array the display mode * @param array the display mode
* @param array the analyzed query * @param array the analyzed query
* *
* @global string the current language * @global string $db the database name
* @global integer the server to use (refers to the number in the * @global string $table the table name
* configuration file) * @global string $goto the url to go back in case of errors
* @global array the current server config * @global boolean $dontlimitchars whether to limit the number of displayed
* @global string the database name * characters of text type fields or not
* @global string the table name * @global string $sql_query the current sql query
* @global string the url to go back in case of errors * @global integer $num_rows the total number of rows returned by the
* @global string the current sql query * sql query
* @global integer the total number of rows returned by the sql query * @global integer $unlim_num_rows the total number of rows returned by the
* @global integer the total number of rows returned by the sql query * sql query without any programmatically
* without any programmatically appended "LIMIT" clause * appended "LIMIT" clause
* @global integer the current postion of the first record to be * @global integer $pos the current postion of the first record
* displayed * to be displayed
* @global array the list of fields properties * @global array $fields_meta the list of fields properties
* @global integer the total number of fields returned by the sql query * @global integer $fields_cnt the total number of fields returned by
* @global array informations used with vertical display mode * the sql query
* @global string the display mode (horizontal/vertical/horizontalflipped) * @global array $vertical_display informations used with vertical display
* @global integer the number of row to display between two table headers * mode
* @global boolean whether to limit the number of displayed characters of * @global string $disp_direction the display mode
* text type fields or not * (horizontal/vertical/horizontalflipped)
* @global array the relation settings * @global integer $repeat_cells the number of row to display between two
* table headers
* @global array $highlight_columns collumn names to highlight
* @global array $cfgRelation the relation settings
* *
* @access private * @access private
* *
@@ -1742,11 +1724,9 @@ function PMA_displayVerticalTable()
*/ */
function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
{ {
global $lang, $server, $cfg, $db, $table; global $db, $table, $goto, $dontlimitchars;
global $goto, $text_url;
global $sql_query, $num_rows, $unlim_num_rows, $pos, $fields_meta, $fields_cnt; global $sql_query, $num_rows, $unlim_num_rows, $pos, $fields_meta, $fields_cnt;
global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns; global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns;
global $dontlimitchars;
global $cfgRelation; global $cfgRelation;
// 1. ----- Prepares the work ----- // 1. ----- Prepares the work -----
@@ -1863,17 +1843,31 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
$delete_text = $is_display['del_lnk'] == 'dr' ? $GLOBALS['strDelete'] : $GLOBALS['strKill']; $delete_text = $is_display['del_lnk'] == 'dr' ? $GLOBALS['strDelete'] : $GLOBALS['strKill'];
$propicon = (string)$GLOBALS['cfg']['PropertiesIconic']; $propicon = (string)$GLOBALS['cfg']['PropertiesIconic'];
$uncheckall_url = 'sql.php?'
. PMA_generate_common_url($db, $table)
. '&amp;sql_query=' . urlencode($sql_query)
. '&amp;pos=' . $pos
. '&amp;session_max_rows=' . $GLOBALS['session_max_rows']
. '&amp;pos=' . $pos
. '&amp;disp_direction=' . $disp_direction
. '&amp;repeat_cells=' . $repeat_cells
. '&amp;goto=' . $goto
. '&amp;dontlimitchars=' . $dontlimitchars;
$checkall_url = $uncheckall_url . '&amp;checkall=1';
$checkall_params['onclick'] = 'setCheckboxesRange(\'rowsDeleteForm\', true, \'id_rows_to_delete\', 0, ' . $num_rows . '); return false;';
$uncheckall_params['onclick'] = 'setCheckboxesRange(\'rowsDeleteForm\', false, \'id_rows_to_delete\', 0, ' . $num_rows . '); return false;';
$checkall_link = PMA_linkOrButton( $checkall_url, $GLOBALS['strCheckAll'], $checkall_params, false );
$uncheckall_link = PMA_linkOrButton( $uncheckall_url, $GLOBALS['strUncheckAll'], $uncheckall_params, false );
?> ?>
&nbsp;&nbsp;<img src="<?php echo $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png'; ?>" border="0" width="38" height="22" alt="<?php echo $GLOBALS['strWithChecked']; ?>" /> &nbsp;&nbsp;<img src="<?php echo $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png'; ?>" border="0" width="38" height="22" alt="<?php echo $GLOBALS['strWithChecked']; ?>" />
<a href="<?php echo $text_url . '&amp;checkall=1'; ?>" onclick="setCheckboxesRange('rowsDeleteForm', true, 'id_rows_to_delete', 0, '<?php echo $num_rows; ?>'); return false;"> <?php echo $checkall_link; ?>
<?php echo $GLOBALS['strCheckAll']; ?></a>
&nbsp;/&nbsp; &nbsp;/&nbsp;
<a href="<?php echo $text_url; ?>" onclick="setCheckboxesRange('rowsDeleteForm', false, 'id_rows_to_delete', 0, '<?php echo $num_rows; ?>'); return false;"> <?php echo $uncheckall_link; ?>
<?php echo $GLOBALS['strUncheckAll']; ?></a>
<?php <?php
echo '&nbsp;&nbsp;<i>' . $GLOBALS['strWithChecked'] . '</i>'. "\n"; echo '&nbsp;&nbsp;<i>' . $GLOBALS['strWithChecked'] . '</i>'. "\n";
if ($cfg['PropertiesIconic']) { if ($GLOBALS['cfg']['PropertiesIconic']) {
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', $GLOBALS['strChange'], 'b_edit.png'); PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', $GLOBALS['strChange'], 'b_edit.png');
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_delete', $delete_text, 'b_drop.png'); PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_delete', $delete_text, 'b_drop.png');
if ($analyzed_sql[0]['querytype'] == 'SELECT') { if ($analyzed_sql[0]['querytype'] == 'SELECT') {

View File

@@ -45,7 +45,11 @@ function confirmLink(theLink, theSqlQuery)
var is_confirmed = confirm(confirmMsg + ' :\n' + theSqlQuery); var is_confirmed = confirm(confirmMsg + ' :\n' + theSqlQuery);
if (is_confirmed) { if (is_confirmed) {
theLink.href += '&is_js_confirmed=1'; if ( typeof(theLink.href) != 'undefined' ) {
theLink.href += '&is_js_confirmed=1';
} else if ( typeof(theLink.form) != 'undefined' ) {
theLink.form.action += '?is_js_confirmed=1';
}
} }
return is_confirmed; return is_confirmed;

View File

@@ -50,13 +50,29 @@ function PMA_gpc_extract($array, &$target, $sanitize = TRUE) {
return TRUE; return TRUE;
} }
// check if a subform is submitted
$__redirect = NULL;
if ( isset( $_POST['usesubform'] ) ) {
// if a subform is present and should be used
// the rest of the form is deprecated
$subform_id = key( $_POST['usesubform'] );
$subform = $_POST['subform'][$subform_id];
$_POST = $subform;
if ( isset( $_POST['redirect'] )
&& $_POST['redirect'] != basename( $_SERVER['PHP_SELF'] ) ) {
$__redirect = $_POST['redirect'];
unset( $_POST['redirect'] );
} // end if ( isset( $_POST['redirect'] ) )
} // end if ( isset( $_POST['usesubform'] ) )
// end check if a subform is submitted
if (!empty($_GET)) { if (!empty($_GET)) {
PMA_gpc_extract($_GET, $GLOBALS); PMA_gpc_extract($_GET, $GLOBALS);
} // end if } // end if
if (!empty($_POST)) { if (!empty($_POST)) {
PMA_gpc_extract($_POST, $GLOBALS); PMA_gpc_extract($_POST, $GLOBALS);
} // end if } // end if (!empty($_POST))
if (!empty($_FILES)) { if (!empty($_FILES)) {
foreach ($_FILES AS $name => $value) { foreach ($_FILES AS $name => $value) {
@@ -82,4 +98,8 @@ if (isset($goto) && strpos(' ' . $goto, '/') > 0 && substr($goto, 0, 2) != './')
unset($goto); unset($goto);
} // end if } // end if
if ( ! empty( $__redirect ) ) {
require('./' . $__redirect);
exit();
} // end if ( ! empty( $__redirect ) )
?> ?>