fixed undeclared javascript variables

This commit is contained in:
Sebastian Mendel
2005-12-15 09:18:30 +00:00
parent 541c4b9111
commit 4c0f4addb5
2 changed files with 50 additions and 49 deletions

View File

@@ -11,6 +11,7 @@ $Source$
- check config file also on wakeup (bug #1376522) - check config file also on wakeup (bug #1376522)
* libraries/Config.class.php, libraries/common.lib.php: * libraries/Config.class.php, libraries/common.lib.php:
fixed handling of https and $cfg['ForceSSL'] (bug #1379491) fixed handling of https and $cfg['ForceSSL'] (bug #1379491)
* left.php: fixed undeclared javascript variables
2005-12-14 Michal Čihař <michal@cihar.com> 2005-12-14 Michal Čihař <michal@cihar.com>
* libraries/config.default.php, Documentation.html: Transliterate invalid * libraries/config.default.php, Documentation.html: Transliterate invalid

View File

@@ -34,7 +34,7 @@ if ($server > 0) {
// this function is defined in "common.lib.php" // this function is defined in "common.lib.php"
// it defines $num_dbs and $dblist // it defines $num_dbs and $dblist
PMA_availableDatabases(); PMA_availableDatabases();
if ( empty( $db ) && count( $dblist ) === 1 ) { if ( empty( $db ) && count( $dblist ) === 1 ) {
reset( $dblist ); reset( $dblist );
$db = current( $dblist ); $db = current( $dblist );
@@ -79,13 +79,13 @@ echo "<?xml version=\"1.0\" encoding=\"" . $GLOBALS['charset'] . "\"?".">";
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
//<![CDATA[ //<![CDATA[
function toggle( id, only_open ) { function toggle( id, only_open ) {
el = document.getElementById('subel' + id); var el = document.getElementById('subel' + id);
if ( ! el ) { if ( ! el ) {
return false; return false;
} }
img = document.getElementById('el' + id + 'Img'); var img = document.getElementById('el' + id + 'Img');
if ( el.style.display == 'none' || only_open ) { if ( el.style.display == 'none' || only_open ) {
el.style.display = ''; el.style.display = '';
if ( img ) { if ( img ) {
@@ -112,7 +112,7 @@ require './libraries/left_header.inc.php';
if ( $num_dbs === 0 ) { if ( $num_dbs === 0 ) {
// no database available, so we break here // no database available, so we break here
echo '<p>' . $strNoDatabases . '</p></body></html>'; echo '<p>' . $strNoDatabases . '</p></body></html>';
/** /**
* Close MySql connections * Close MySql connections
*/ */
@@ -122,7 +122,7 @@ if ( $num_dbs === 0 ) {
if (isset($userlink) && $userlink) { if (isset($userlink) && $userlink) {
@PMA_DBI_close($userlink); @PMA_DBI_close($userlink);
} }
/** /**
* Sends bufferized data * Sends bufferized data
*/ */
@@ -134,7 +134,7 @@ if ( $num_dbs === 0 ) {
// more than one database available and LeftFrameLight is true // more than one database available and LeftFrameLight is true
// display db selectbox // display db selectbox
?> ?>
<div id="databaseList"> <div id="databaseList">
<form method="post" action="index.php" target="_parent" id="left"> <form method="post" action="index.php" target="_parent" id="left">
<label for="lightm_db"><?php echo $strDatabase; ?></label> <label for="lightm_db"><?php echo $strDatabase; ?></label>
@@ -147,7 +147,7 @@ if ( $num_dbs === 0 ) {
.'</form>' . "\n" .'</form>' . "\n"
.'</div>' . "\n"; .'</div>' . "\n";
} }
?> ?>
<div id="left_tableList"> <div id="left_tableList">
<?php <?php
@@ -165,9 +165,9 @@ if ( $num_dbs === 0 ) {
// within left.php. With no JS (<noscript>) the whole frameset will // within left.php. With no JS (<noscript>) the whole frameset will
// be rebuilt with the new target frame. // be rebuilt with the new target frame.
$img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"' $img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"'
.' width="9" height="9" alt="+" />'; .' width="9" height="9" alt="+" />';
$img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"' $img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"'
.' width="9" height="9" alt="-" />'; .' width="9" height="9" alt="-" />';
$href_left = '<a onclick="if ( toggle(\'%d\') ) return false;"' $href_left = '<a onclick="if ( toggle(\'%d\') ) return false;"'
@@ -194,7 +194,7 @@ if ( $GLOBALS['cfg']['LeftFrameLight'] && ! empty( $db ) ) {
$db_tooltip = $db; $db_tooltip = $db;
} }
?> ?>
<p><a class="item" <p><a class="item"
href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query; ?>" href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query; ?>"
title="<?php echo htmlspecialchars($db_tooltip); ?>" > title="<?php echo htmlspecialchars($db_tooltip); ?>" >
@@ -224,7 +224,7 @@ if ( $GLOBALS['cfg']['LeftFrameLight'] && ! empty( $db ) ) {
/** /**
* displays collapsable db list * displays collapsable db list
* *
* @uses $_REQUEST['dbgroup'] * @uses $_REQUEST['dbgroup']
* @uses $GLOBALS['cfg']['DefaultTabDatabase'] * @uses $GLOBALS['cfg']['DefaultTabDatabase']
* @uses $GLOBALS['strSelectADb'] * @uses $GLOBALS['strSelectADb']
@@ -247,7 +247,7 @@ if ( $GLOBALS['cfg']['LeftFrameLight'] && ! empty( $db ) ) {
function PMA_displayDbList( $ext_dblist ) { function PMA_displayDbList( $ext_dblist ) {
global $element_counter, $img_minus, $img_plus, $href_left, $num_dbs, global $element_counter, $img_minus, $img_plus, $href_left, $num_dbs,
$db_start, $common_url_query; $db_start, $common_url_query;
$url_dbgroup = ''; $url_dbgroup = '';
echo '<ul id="leftdatabaselist">'; echo '<ul id="leftdatabaselist">';
$close_db_group = false; $close_db_group = false;
@@ -265,7 +265,7 @@ function PMA_displayDbList( $ext_dblist ) {
$common_url_query = PMA_generate_common_url() . $url_dbgroup; $common_url_query = PMA_generate_common_url() . $url_dbgroup;
$element_counter++; $element_counter++;
echo '<li class="dbgroup">'; echo '<li class="dbgroup">';
if ( ( ! empty( $_REQUEST['dbgroup'] ) && $_REQUEST['dbgroup'] == $group ) if ( ( ! empty( $_REQUEST['dbgroup'] ) && $_REQUEST['dbgroup'] == $group )
|| $db_start == $group || strpos( $db_start, $group ) === 0 ) { || $db_start == $group || strpos( $db_start, $group ) === 0 ) {
// display + only if this db(group) is not preselected // display + only if this db(group) is not preselected
printf( $href_left, $element_counter, PMA_generate_common_url() ); printf( $href_left, $element_counter, PMA_generate_common_url() );
@@ -275,7 +275,7 @@ function PMA_displayDbList( $ext_dblist ) {
printf( $img_plus, $element_counter ); printf( $img_plus, $element_counter );
} }
echo '</a> ' . $group . "\n"; echo '</a> ' . $group . "\n";
if ( ( ! empty( $_REQUEST['dbgroup'] ) && $_REQUEST['dbgroup'] == $group ) if ( ( ! empty( $_REQUEST['dbgroup'] ) && $_REQUEST['dbgroup'] == $group )
|| $db_start == $group || strpos( $db_start, $group ) === 0 ) { || $db_start == $group || strpos( $db_start, $group ) === 0 ) {
echo '<ul id="subel' . $element_counter . '">' . "\n"; echo '<ul id="subel' . $element_counter . '">' . "\n";
} else { } else {
@@ -286,11 +286,11 @@ function PMA_displayDbList( $ext_dblist ) {
} }
foreach ( $db_group as $db ) { foreach ( $db_group as $db ) {
$common_url_query = PMA_generate_common_url( $db['name'] ) . $url_dbgroup; $common_url_query = PMA_generate_common_url( $db['name'] ) . $url_dbgroup;
$element_counter++; $element_counter++;
// Displays the database name // Displays the database name
echo '<li>' . "\n"; echo '<li>' . "\n";
if ( $num_dbs > 1 ) { if ( $num_dbs > 1 ) {
// only with more than one db we need collapse ... // only with more than one db we need collapse ...
if ( $db_start != $db['name'] || $db['num_tables'] < 1 ) { if ( $db_start != $db['name'] || $db['num_tables'] < 1 ) {
@@ -304,18 +304,18 @@ function PMA_displayDbList( $ext_dblist ) {
printf( $img_minus, $element_counter ); printf( $img_minus, $element_counter );
} }
echo '</a>'; echo '</a>';
// ... and we need to refresh both frames on db selection // ... and we need to refresh both frames on db selection
?> ?>
<a class="item" <a class="item"
id="<?php echo htmlspecialchars( $db['name'] ); ?>" id="<?php echo htmlspecialchars( $db['name'] ); ?>"
href="index.php?<?php echo $common_url_query; ?>" href="index.php?<?php echo $common_url_query; ?>"
target="_parent" target="_parent"
title="<?php echo htmlspecialchars( $db['comment'] ); ?>" title="<?php echo htmlspecialchars( $db['comment'] ); ?>"
onclick=" onclick="
if ( ! toggle('<?php echo $element_counter; ?>', true) ) if ( ! toggle('<?php echo $element_counter; ?>', true) )
window.parent.goTo( './left.php?<?php echo $common_url_query; ?>' ); window.parent.goTo( './left.php?<?php echo $common_url_query; ?>' );
window.parent.goTo( './<?php echo $GLOBALS['cfg']['DefaultTabDatabase'] window.parent.goTo( './<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
. '?' . $common_url_query; ?>', 'main' ); . '?' . $common_url_query; ?>', 'main' );
return false;"> return false;">
<?php <?php
@@ -326,14 +326,14 @@ function PMA_displayDbList( $ext_dblist ) {
if ( $GLOBALS['text_dir'] === 'ltr' ) { if ( $GLOBALS['text_dir'] === 'ltr' ) {
echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> '; echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
} }
?> ?>
</a> </a>
<?php <?php
} else { } else {
// with only 1 db available we dont need to refresh left frame // with only 1 db available we dont need to refresh left frame
// on db selection, only phpmain // on db selection, only phpmain
?> ?>
<a href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase'] <a href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
. '?' . $common_url_query; ?>" . '?' . $common_url_query; ?>"
id="<?php echo htmlspecialchars( $db['name'] ); ?>" id="<?php echo htmlspecialchars( $db['name'] ); ?>"
title="<?php echo htmlspecialchars( $db['comment'] ); ?>"> title="<?php echo htmlspecialchars( $db['comment'] ); ?>">
@@ -345,11 +345,11 @@ function PMA_displayDbList( $ext_dblist ) {
if ( $GLOBALS['text_dir'] === 'ltr' ) { if ( $GLOBALS['text_dir'] === 'ltr' ) {
echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> '; echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
} }
?> ?>
</a> </a>
<?php <?php
} }
if ( $db['num_tables'] ) { if ( $db['num_tables'] ) {
$tables = PMA_getTableList( $db['name'] ); $tables = PMA_getTableList( $db['name'] );
$child_visible = $child_visible =
(bool) ($num_dbs === 1 || $db_start == $db['name']); (bool) ($num_dbs === 1 || $db_start == $db['name']);
@@ -362,14 +362,14 @@ function PMA_displayDbList( $ext_dblist ) {
echo '</li>' . "\n"; echo '</li>' . "\n";
} // end foreach db } // end foreach db
} // end foreach group } // end foreach group
if ( $close_db_group ) { if ( $close_db_group ) {
$url_dbgroup = ''; $url_dbgroup = '';
echo '</ul>'; echo '</ul>';
echo '</li>'; echo '</li>';
$close_db_group = false; $close_db_group = false;
} }
echo '</ul>' . "\n"; echo '</ul>' . "\n";
} }
@@ -377,7 +377,7 @@ function PMA_displayDbList( $ext_dblist ) {
* display unordered list of tables * display unordered list of tables
* calls itself recursively if table in given list * calls itself recursively if table in given list
* is a list itself * is a list itself
* *
* @uses is_array() * @uses is_array()
* @uses count() * @uses count()
* @uses urlencode() * @uses urlencode()
@@ -407,14 +407,14 @@ function PMA_displayDbList( $ext_dblist ) {
*/ */
function PMA_displayTableList( $tables, $visible = false, function PMA_displayTableList( $tables, $visible = false,
$tab_group_full = '', $table_db = '' ) { $tab_group_full = '', $table_db = '' ) {
if ( ! is_array( $tables ) || count( $tables ) === 0 ) { if ( ! is_array( $tables ) || count( $tables ) === 0 ) {
return; return;
} }
global $element_counter, $img_minus, $img_plus, $href_left; global $element_counter, $img_minus, $img_plus, $href_left;
$sep = $GLOBALS['cfg']['LeftFrameTableSeparator']; $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
if ( $visible ) { if ( $visible ) {
echo '<ul id="subel' . $element_counter . '">'; echo '<ul id="subel' . $element_counter . '">';
} else { } else {
@@ -422,12 +422,12 @@ function PMA_displayTableList( $tables, $visible = false,
} }
foreach( $tables as $group => $table ) { foreach( $tables as $group => $table ) {
if ( isset( $table['is' . $sep . 'group'] ) ) { if ( isset( $table['is' . $sep . 'group'] ) ) {
$common_url_query = $GLOBALS['common_url_query'] $common_url_query = $GLOBALS['common_url_query']
. '&amp;tbl_group=' . urlencode( $tab_group_full . $group ); . '&amp;tbl_group=' . urlencode( $tab_group_full . $group );
$element_counter++; $element_counter++;
echo '<li>' . "\n"; echo '<li>' . "\n";
if ( $visible && if ( $visible &&
(( isset( $_REQUEST['tbl_group'] ) (( isset( $_REQUEST['tbl_group'] )
&& ( strpos( $_REQUEST['tbl_group'], $group ) === 0 && ( strpos( $_REQUEST['tbl_group'], $group ) === 0
|| strpos( $_REQUEST['tbl_group'], $sep . $group ) !== false ) ) || strpos( $_REQUEST['tbl_group'], $sep . $group ) !== false ) )
@@ -442,13 +442,13 @@ function PMA_displayTableList( $tables, $visible = false,
printf( $img_plus, $element_counter ); printf( $img_plus, $element_counter );
} }
echo '</a>'; echo '</a>';
?> ?>
<a href="index.php?<?php echo $common_url_query; ?>" <a href="index.php?<?php echo $common_url_query; ?>"
target="_parent" target="_parent"
onclick=" onclick="
if ( ! toggle('<?php echo $element_counter; ?>', true) ) if ( ! toggle('<?php echo $element_counter; ?>', true) )
window.parent.goTo( './left.php?<?php echo $common_url_query; ?>' ); window.parent.goTo( './left.php?<?php echo $common_url_query; ?>' );
window.parent.goTo( './<?php echo $GLOBALS['cfg']['DefaultTabDatabase'] window.parent.goTo( './<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
. '?' . $common_url_query; ?>', 'main' ); . '?' . $common_url_query; ?>', 'main' );
return false;"> return false;">
<?php <?php
@@ -459,15 +459,15 @@ function PMA_displayTableList( $tables, $visible = false,
if ( $GLOBALS['text_dir'] === 'ltr' ) { if ( $GLOBALS['text_dir'] === 'ltr' ) {
echo ' <bdo dir="ltr">(' . $table['tab_count'] . ')</bdo> '; echo ' <bdo dir="ltr">(' . $table['tab_count'] . ')</bdo> ';
} }
?> ?>
</a> </a>
<?php <?php
unset( $table['is' . $sep . 'group'] ); unset( $table['is' . $sep . 'group'] );
unset( $table['tab' . $sep . 'group'] ); unset( $table['tab' . $sep . 'group'] );
unset( $table['tab' . $sep . 'count'] ); unset( $table['tab' . $sep . 'count'] );
if ( $visible && if ( $visible &&
(( isset( $_REQUEST['tbl_group'] ) (( isset( $_REQUEST['tbl_group'] )
&& ( strpos( $_REQUEST['tbl_group'], $group ) === 0 && ( strpos( $_REQUEST['tbl_group'], $group ) === 0
|| strpos( $_REQUEST['tbl_group'], $sep . $group ) !== false ) ) || strpos( $_REQUEST['tbl_group'], $sep . $group ) !== false ) )
@@ -481,15 +481,15 @@ function PMA_displayTableList( $tables, $visible = false,
} }
echo '</li>' . "\n"; echo '</li>' . "\n";
} elseif ( is_array( $table ) ) { } elseif ( is_array( $table ) ) {
$href = $GLOBALS['cfg']['DefaultTabTable'] . '?' $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
.$GLOBALS['common_url_query'] . '&amp;table=' .$GLOBALS['common_url_query'] . '&amp;table='
.urlencode( $table['Name'] ); .urlencode( $table['Name'] );
echo '<li>' . "\n"; echo '<li>' . "\n";
echo '<a title="' . $GLOBALS['strBrowse'] . ': ' echo '<a title="' . $GLOBALS['strBrowse'] . ': '
. htmlspecialchars( $table['Comment'] ) . htmlspecialchars( $table['Comment'] )
.' (' . PMA_formatNumber( $table['Rows'], 0 ) . ' ' . $GLOBALS['strRows'] . ')"' .' (' . PMA_formatNumber( $table['Rows'], 0 ) . ' ' . $GLOBALS['strRows'] . ')"'
.' id="browse_' . htmlspecialchars( $table_db . '.' . $table['Name'] ) . '"' .' id="browse_' . htmlspecialchars( $table_db . '.' . $table['Name'] ) . '"'
.' href="sql.php?' . $GLOBALS['common_url_query'] .' href="sql.php?' . $GLOBALS['common_url_query']
.'&amp;table=' . urlencode( $table['Name'] ) .'&amp;table=' . urlencode( $table['Name'] )
.'&amp;goto=' . $GLOBALS['cfg']['DefaultTabTable'] .'&amp;goto=' . $GLOBALS['cfg']['DefaultTabTable']
. '" >' . '" >'
@@ -510,7 +510,7 @@ function PMA_displayTableList( $tables, $visible = false,
} }
echo '</ul>'; echo '</ul>';
} }
?> ?>
</div> </div>
</body> </body>
</html> </html>