define variables only where needed

This commit is contained in:
Sebastian Mendel
2005-11-26 06:59:49 +00:00
parent 5afd8905a6
commit 82572774cd
6 changed files with 30 additions and 4 deletions

View File

@@ -7,9 +7,12 @@ $Source$
2005-11-24 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/grab_globals.lib.php: allow scripts to bypass importing vars
* libraries/common.lib.php, libraries/export/sql.php: define variables only
where needed, and use NULL to define them, as some places test only for
isset and not for content
* libraries/common.lib.php, libraries/export/sql.php,
libraries/display_tbl.lib.php, libraries/mult_submits.inc.php, sql.php,
tbl_replace.php, tbl_row_action.php:
define variables only where needed, and use NULL to define them
if some places test only for isset and not for content
2005-11-25 Marc Delisle <lem9@users.sourceforge.net>
* main.php: move server choice into MySQL container

View File

@@ -6,6 +6,13 @@
* Set of functions used to display the records returned by a sql query
*/
/**
* Avoids undefined variables
*/
if (!isset($pos)) {
$pos = 0;
}
/**
* Defines the display mode to use for the results of a sql query
*

View File

@@ -252,7 +252,7 @@ if ( !empty($submit_mult) && !empty($what)) {
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="dontlimitchars" value="' . $dontlimitchars . '" />' . "\n";
echo '<input type="hidden" name="pos" value="' . $pos . '" />' . "\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";
}
?>

View File

@@ -85,6 +85,12 @@ if (isset($find_real_end) && $find_real_end) {
$unlim_num_rows = PMA_countRecords($db, $table, TRUE, TRUE);
$pos = @((ceil($unlim_num_rows / $session_max_rows) - 1) * $session_max_rows);
}
/**
* Avoids undefined variables
*/
elseif (!isset($pos)) {
$pos = 0;
}
/**
* Bookmark add

View File

@@ -22,6 +22,9 @@ if (isset($sql_query)) {
if (!isset($dontlimitchars)) {
$dontlimitchars = 0;
}
if (!isset($pos)) {
$pos = 0;
}
$is_gotofile = FALSE;
if (isset($after_insert) && $after_insert == 'new_insert') {
$goto = 'tbl_change.php?'

View File

@@ -4,6 +4,13 @@
require_once('./libraries/common.lib.php');
require_once('./libraries/mysql_charsets.lib.php');
/**
* Avoids undefined variables
*/
if (!isset($pos)) {
$pos = 0;
}
/**
* No rows were selected => show again the query and tell that user.
*/