3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Gets the variables sent to this script, retains the db name that may have
8 * been defined as startup option and include a core library
10 require_once('./libraries/grab_globals.lib.php');
11 if (isset($lightm_db) && !empty($lightm_db)) {
12 // no longer urlencoded because of html entities in the db name
13 // $db = urldecode($lightm_db);
23 * Gets a core script and starts output buffering work
25 require_once('./libraries/common.lib.php');
26 require_once('./libraries/ob.lib.php');
28 $ob_mode = PMA_outBufferModeGet();
30 PMA_outBufferPre($ob_mode);
34 // This check had been put here to avoid revealing the full path
35 // of the phpMyAdmin directory in case this script is called
36 // directly. But some users report a "Missing hash" message and
37 // I cannot reproduce it, so let's define $hash to a dummy value
38 // and hope some other clue will surface, to sort this bug.
39 //PMA_checkParameters(array('hash'));
44 require_once('./libraries/bookmark.lib.php');
45 require_once('./libraries/relation.lib.php');
46 $cfgRelation = PMA_getRelationsParam();
48 function PMA_reduceNest($_table) {
50 if ($GLOBALS['cfg']['LeftFrameTableLevel'] > 0) {
51 $max = $GLOBALS['cfg']['LeftFrameTableLevel'];
52 $temp_table = $_table;
55 for ($ti = 0; $ti < $max; $ti++
) {
56 if (isset($temp_table[$ti])) {
57 $new_table[$ti] = $temp_table[$ti];
58 unset($temp_table[$ti]);
69 function PMA_indent($spaces) {
71 for ($i = 0; $i <= $spaces; $i++
) {
78 function PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val, $childout = true) {
80 $id = preg_replace('@[^a-z0-9]*@i', '', $baseid . $keyhistory . $key) . $indent;
82 $on_mouse = (($GLOBALS['cfg']['LeftPointerColor'] == '') ?
'' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $id . '\', \'' . $GLOBALS['cfg']['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $id . '\', \'' . $GLOBALS['cfg']['LeftBgColor'] . '\')}"');
85 if (count($countarray) == 2 && isset($countarray['pma_name']) && isset($countarray['pma_list_item'])) {
86 $counter = count($countarray['pma_name']);
88 unset($countarray['pma_name']);
89 if (count($countarray) > 1) {
90 unset($countarray['pma_list_item']);
92 $counter = count($countarray);
96 echo PMA_indent($indent * 5) . '<div id="el' . $id . 'Parent" class="parent"' . $on_mouse . '>' . "\n";
97 echo PMA_indent($indent * 6) . '<nobr><img src="images/spacer.gif" border="0" width="' . (($indent - 1) * $indent_level) . '" height="9" alt="" /><a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '" onclick="if (capable) {expandBase(\'el' . $id . '\', true); return false} else {return true}">';
98 echo '<img name="imEx" id="el' . $id . 'Img" src="images/plus.png" border="0" width="9" height="9" alt="+" /></a>' . "\n";
99 echo PMA_indent($indent * 6) . '<a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '" title="' . htmlspecialchars($name) . '" onclick="if (capable) {expandBase(\'el' . $id . '\', false)}"><span class="heada">' . htmlspecialchars($name) . '<bdo dir="' . $GLOBALS['text_dir'] . '"> </bdo></span><span class="headaCnt">(' . $counter . ')</span></a></nobr>' . "\n";
100 echo PMA_indent($indent * 5) . '</div><id class="PMA_nestedSetHeaderParent">' . "\n";
104 echo PMA_indent($indent * 5) . '<div id="el' . $id . 'Child" class="child" ' . $on_mouse . '>' . "\n";
108 function PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent_level, $headerOut, $firstGroup = false, $firstGroupClose = true) {
110 PMA_nestedSetHeaderParent($baseid, $firstGroup, $keyhistory, $indent, $indent_level, $tablestack);
114 foreach($tablestack AS $key => $val) {
115 if ($key != 'pma_name' && $key != 'pma_list_item') {
117 PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val);
120 if (isset($val['pma_name']) && isset($val['pma_list_item']) && count($val) == 2) {
121 PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, false, ($indent +
1));
123 PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, true, ($indent +
1));
127 echo PMA_indent($indent * 5) . '</div><id class="PMA_nestedSetHeader">' . "\n";
132 if ($firstGroup && $firstGroupClose) {
133 echo PMA_indent($indent * 4) . '</div><id class="PMA_nestedSetHeader2">' . "\n";
134 } elseif ($firstGroup) {
135 echo PMA_indent($indent * 4) . '<id spacer="div omitted" class="PMA_nestedSetHeader2">' . "\n";
139 function PMA_nestedSet($baseid, $tablestack, $key = '__protected__', $keyhistory = '', $headerOut = false, $indent = 1) {
141 if ($keyhistory == '' && $key != '__protected__') {
147 if (isset($tablestack)
148 && isset($tablestack['pma_name'])
149 && isset($tablestack['pma_list_item'])) {
151 if (count($tablestack) > 1 && !empty($key) && isset($tablestack['pma_name']) && isset($tablestack['pma_list_item']) && $indent == 1) {
152 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, ($indent+
1), $indent_level, $headerOut, $key, false);
156 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent_level, $headerOut);
161 $on_mouse = (($GLOBALS['cfg']['LeftPointerColor'] == '') ?
'' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $keyhistory . $key . '\', \'' . $GLOBALS['cfg']['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $keyhistory . $key . '\', \'' . $GLOBALS['cfg']['LeftBgColor'] . '\')}"');
164 foreach($tablestack['pma_name'] AS $tkey => $tval) {
166 echo PMA_indent($indent * 5) . '<nobr><img src="images/spacer.gif" border="0" width="' . (($indent+
$extra_indent) * $indent_level) . '" height="9" alt="" />';
167 $items = explode("\n", $tablestack['pma_list_item'][$tkey]);
168 foreach($items AS $ikey => $ival) {
170 echo PMA_indent(($indent * 5)) . $ival;
178 echo PMA_indent($indent * 5) . '</div><id space="putting omitted div" class="PMA_nestedSet2">';
181 } elseif (is_array($tablestack)) {
182 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, (($key == '__protected__' && $indent == 1 )?
($indent-1) : ($indent +
1)), $indent_level, $headerOut, (($key == '__protected__' && $indent == 1) ||
($indent > 1) ?
false : $key));
188 * Get the list and number of available databases.
189 * Skipped if no server selected: in this case no database should be displayed
190 * before the user choose among available ones at the welcome screen.
193 PMA_availableDatabases(); // this function is defined in "common.lib.php"
199 // garvin: For re-usability, moved http-headers
200 // to a seperate file. It can now be included by header.inc.php,
201 // queryframe.php, querywindow.php.
203 require_once('./libraries/header_http.inc.php');
208 // Gets the font sizes to use
211 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
212 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
213 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="<?php echo $available_languages[$lang][2]; ?>" lang
="<?php echo $available_languages[$lang][2]; ?>" dir
="<?php echo $text_dir; ?>">
216 <title
>phpMyAdmin
</title
>
217 <meta http
-equiv
="Content-Type" content
="text/html; charset=<?php echo $charset; ?>" />
218 <base
<?php
if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?
> target
="phpmain<?php echo $hash; ?>" />
220 <script type
="text/javascript" language
="javascript">
223 if (isset($lightm_db) && !empty($lightm_db)) {
225 window
.parent
.frames
['phpmain<?php echo $hash; ?>'].location
.replace('./<?php echo $cfg['DefaultTabDatabase
'] . '?
' . PMA_generate_common_url($db, '', '&');?>');
227 } elseif (isset($lightm_db)) {
229 window
.parent
.frames
['phpmain<?php echo $hash; ?>'].location
.replace('./main.php?<?php echo PMA_generate_common_url('', '', '&');?>');
237 // Expandable/collapsible databases list is only used if there is more than one
238 // database to display
239 if (($num_dbs > 1 ||
!empty($cfg['LeftFrameTableSeparator'])) && !$cfg['LeftFrameLight']) {
242 <!-- Collapsible tables
list scripts
-->
243 <script type
="text/javascript" language
="javascript">
245 var isDOM
= (typeof(document
.getElementsByTagName
) != 'undefined'
246 && typeof(document
.createElement
) != 'undefined')
248 var isIE4
= (typeof(document
.all
) != 'undefined'
249 && parseInt(navigator
.appVersion
) >= 4)
251 var isNS4
= (typeof(document
.layers
) != 'undefined')
253 var capable
= (isDOM || isIE4 || isNS4
)
255 // Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant
257 if (typeof(window
.opera
) != 'undefined') {
258 var browserName
= ' ' + navigator
.userAgent
.toLowerCase();
259 if ((browserName
.indexOf('konqueror 7') == 0)) {
263 else if (typeof(navigator
.userAgent
) != 'undefined') {
264 var browserName
= ' ' + navigator
.userAgent
.toLowerCase();
265 if ((browserName
.indexOf('konqueror') > 0) && (browserName
.indexOf('konqueror/3') == 0)) {
268 } // end if... else if...
271 var isServer
= <?php
echo ($server > 0) ?
'true' : 'false'; ?
>;
273 document
.writeln('<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?lang=<?php echo $lang; ?>&js_frame=left&js_capable=' + capable +
'&js_isDOM=' + isDOM +
'&js_isIE4=' + isIE4 +
'" />');
277 <link rel
="stylesheet" type
="text/css" href
="./css/phpmyadmin.css.php?lang=<?php echo $lang; ?>&js_frame=left&js_capable=0&js_isDOM=0&js_isIE4=0" />
280 <script src
="libraries/left.js" type
="text/javascript" language
="javascript1.2"></script
>
282 } // end if ($num_dbs > 1)
284 else if ($num_dbs == 1) {
287 <link rel
="stylesheet" type
="text/css" href
="./css/phpmyadmin.css.php?js_frame=left&js_capable=0&js_isDOM=0&js_isIE4=0" />
289 } // end if ($num_dbs == 1)
294 <link rel
="stylesheet" type
="text/css" href
="./css/phpmyadmin.css.php?js_frame=left&num_dbs=0" />
296 } // end if ($num_dbs < 1)
302 <body bgcolor
="<?php echo $cfg['LeftBgColor']; ?>">
305 if ($cfg['LeftDisplayLogo']) {
307 <!-- phpMyAdmin logo
-->
308 <a href
="http://www.phpmyadmin.net" target
="_blank"><img src
="./images/pma_logo.png" width
="88" height
="31" border
="0" alt
="phpMyAdmin" /></a
>
312 if ($cfg['LeftDisplayServers']) {
314 <form method
="post" action
="index.php" target
="_parent">
315 <select name
="server" onchange
="this.form.submit();">
318 foreach($cfg['Servers'] AS $key => $val) {
319 if (!empty($val['host'])) {
320 echo ' <option value="' . $key . '"';
321 if (!empty($server) && ($server == $key)) {
322 echo ' selected="selected"';
325 if (!empty($val['verbose'])) {
326 echo $val['verbose'];
329 if (!empty($val['port'])) {
330 echo ':' . $val['port'];
332 // loic1: skip this because it's not a so good idea to display
333 // sockets used to everybody
334 // if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) {
335 // echo ':' . $val['socket'];
338 // loic1: if 'only_db' is an array and there is more than one
339 // value, displaying such informations may not be a so good
341 if (!empty($val['only_db'])) {
342 echo ' - ' . (is_array($val['only_db']) ?
implode(', ', $val['only_db']) : $val['only_db']);
344 if (!empty($val['user']) && ($val['auth_type'] == 'config')) {
345 echo ' (' . $val['user'] . ')';
347 echo ' </option>' . "\n";
348 } // end if (!empty($val['host']))
352 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
353 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
354 <noscript
><input type
="submit" value
="<?php echo $strGo; ?>" /></noscript
>
360 <!-- Link to the welcome page
-->
361 <div id
="el1Parent" class="parent" style
="margin-bottom: 5px">
362 <nobr
><a
class="item" href
="main.php?<?php echo PMA_generate_common_url(); ?>"><span
class="heada"><b
><?php
echo $strHome; ?
></b
></span
></a
></nobr
>
366 <!-- Databases
and tables
list -->
368 // Don't display expansible/collapsible database info if:
369 // 1. $server == 0 (no server selected)
370 // This is the case when there are multiple servers and
371 // '$cfg['ServerDefault'] = 0' is set. In that case, we want the welcome
372 // screen to appear with no database info displayed.
373 // 2. there is only one database available (ie either only one database exists
374 // or $cfg['Servers']['only_db'] is defined and is not an array)
375 // In this case, the database should not be collapsible/expandable
378 // Light mode -> beginning of the select combo for databases
379 // Note: When javascript is active, the frameset will be changed from
380 // within left.php. With no JS (<noscript>) the whole frameset will
381 // be rebuilt with the new target frame.
382 if ($cfg['LeftFrameLight']) {
384 <script type
="text/javascript" language
="javascript">
385 document
.writeln('<form method="post" action="left.php" name="left" target="nav">');
388 <form method
="post" action
="index.php" name
="left" target
="_parent">
391 echo PMA_generate_common_hidden_inputs();
392 echo ' <input type="hidden" name="hash" value="' . $hash . '" />' . "\n";
393 echo ' <select name="lightm_db" onchange="this.form.submit()">' . "\n";
394 echo ' <option value="">(' . $strDatabases . ') ...</option>' . "\n";
396 $table_list_header = '';
402 // Gets the tables list per database
403 for ($i = 0; $i < $num_dbs; $i++
) {
406 if (!empty($db_start) && $db == $db_start) {
409 $tables = @PMA_mysql_list_tables
($db);
410 $num_tables = ($tables) ? @mysql_numrows
($tables) : 0;
411 $common_url_query = PMA_generate_common_url($db);
413 $num_tables_disp = $num_tables;
415 $num_tables_disp = '-';
418 // Get additional information about tables for tooltip
419 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION
>= 32303
421 && (!$cfg['LeftFrameLight'] ||
$selected_db == $j)) {
423 $tooltip_name = array();
424 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
425 while ($tmp = PMA_mysql_fetch_array($result)) {
426 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '');
427 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] ?
$tmp['Name'] : $tmp['Comment']);
429 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '')
430 . '(' . (isset($tmp['Rows']) ?
$tmp['Rows'] : '0') . ' ' . $strRows . ')';
434 // garvin: Get comments from PMA comments table
436 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
437 $tmp_db_tooltip = PMA_getComments($db);
438 if (is_array($tmp_db_tooltip)) {
439 $db_tooltip = implode(' ', $tmp_db_tooltip);
443 // No light mode -> displays the expandible/collapsible db list
444 if ($cfg['LeftFrameLight'] == FALSE) {
446 // Displays the database name
447 $on_mouse = (($cfg['LeftPointerColor'] == '') ?
'' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftBgColor'] . '\')}"');
450 echo ' <div id="el' . $j . 'Parent" class="parent"' . $on_mouse . '>';
452 if (!empty($num_tables)) {
455 <nobr
><a
class="item" href
="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>" onclick
="if (capable) {expandBase('el<?php echo $j; ?>', true); return false} else {return true}">
456 <img name
="imEx" id
="el<?php echo $j; ?>Img" src
="images/plus.png" border
="0" width
="9" height
="9" alt
="+" /></a
>
461 <nobr
><img name
="imEx" src
="images/minus.png" border
="0" width
="9" height
="9" alt
="-" />
466 <a
class="item" href
="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>" title
="<?php echo ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db) : htmlspecialchars($db_tooltip)); ?>" onclick
="if (capable) {expandBase('el<?php echo $j; ?>', false)}">
467 <span
class="heada"><?php
echo ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
'<i>' . htmlspecialchars($db_tooltip) . '</i>' : htmlspecialchars($db)); ?
><bdo dir
="<?php echo($text_dir); ?>"> 
; 
;</bdo
></span
><span
class="headaCnt">(<?php
echo $num_tables_disp; ?
>)</span
></a
></nobr
>
470 <div id
="el<?php echo $j;?>Child" class="child" style
="margin-bottom: 5px"<?php
echo $on_mouse; ?
>>
472 // Displays the list of tables from the current database
473 $tablestack = array();
474 for ($t = 0; $t < $num_tables; $t++
) {
475 $table = PMA_mysql_tablename($tables, $t);
476 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
477 ?
htmlspecialchars($tooltip_name[$table])
479 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
480 ?
htmlspecialchars($tooltip[$table])
483 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
485 $list_item = '<a target="phpmain' . $hash . '" href="sql.php?' . $common_url_query . '&table=' . urlencode($table) . '&sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ?
urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&pos=0&goto=' . $cfg['DefaultTabTable'] . '" title="' . $strBrowse . ': ' . $url_title . '">';
486 $list_item .= '<img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" /></a>';
487 $list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n";
488 $list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">';
489 $list_item .= ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n";
491 // garvin: Check whether to display nested sets
492 if (!empty($cfg['LeftFrameTableSeparator'])) {
493 $_table = explode($cfg['LeftFrameTableSeparator'], str_replace('\'', '\\\'',$table));
494 if (is_array($_table)) {
495 foreach($_table AS $key => $val) {
497 $_table[$key] = '__protected__';
501 unset($_table[count($_table)-1]);
502 $_table = PMA_reduceNest($_table);
504 $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $table) . '\';';
505 $eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . str_replace('\'', '\\\'', $list_item) . '\';';
508 $tablestack['']['pma_name'][] = $table;
509 $tablestack['']['pma_list_item'][] = $list_item;
512 $tablestack['']['pma_name'][] = $table;
513 $tablestack['']['pma_list_item'][] = $list_item;
515 } // end for $t (tables list)
517 PMA_nestedSet($j, $tablestack);
525 // Light mode -> displays the select combo with databases names and the
526 // list of tables contained in the current database
530 // Builds the databases' names list
531 if (!empty($db_start) && $db == $db_start) {
532 // Gets the list of tables from the current database
533 for ($t = 0; $t < $num_tables; $t++
) {
534 $table = PMA_mysql_tablename($tables, $t);
535 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
536 ?
htmlentities($tooltip[$table])
538 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
539 ?
htmlentities($tooltip_name[$table])
542 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
544 $table_list .= ' <nobr><a target="phpmain' . $hash . '" href="sql.php?' . $common_url_query . '&table=' . urlencode($table) . '&sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ?
urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&pos=0&goto=' . $cfg['DefaultTabTable'] . '">' . "\n";
545 $table_list .= ' <img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" title="' . $strBrowse . ': ' . $url_title . '" /></a><bdo dir="' . $text_dir . '"> </bdo>' . "\n";
546 if (PMA_USR_BROWSER_AGENT
== 'IE') {
547 $table_list .= ' <span class="tblItem"><a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)) . '</a></span></nobr><br />' . "\n";
549 $table_list .= ' <a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n";
551 } // end for $t (tables list)
554 $table_list = ' <br /><br />' . "\n"
555 . ' <div>' . $strNoTablesFound . '</div>' . "\n";
557 $selected = ' selected="selected"';
559 $table_list_header .= ' <a class="item" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabDatabase'] . '?' . $common_url_query . '">' . "\n";
560 $table_list_header .= ' <span class="heada"><b>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasTB'] ?
htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . '</b><bdo dir="' . $text_dir . '"> </bdo></span></a><br />' . "\n\n";
563 } // end if... else...
565 if (!empty($num_tables)) {
566 echo ' <option value="' . htmlspecialchars($db) . '"' . $selected . '>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (' . $num_tables . ')</option>' . "\n";
568 echo ' <option value="' . htmlspecialchars($db) . '"' . $selected . '>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (-)</option>' . "\n";
569 } // end if... else...
571 } // end if (light mode)
573 } // end for $i (db list)
575 // Light mode -> end of the select combo for databases and table list for
576 // the current database
577 if ($cfg['LeftFrameLight']) {
578 echo ' </select>' . "\n";
579 echo ' <noscript><input type="submit" name="Go" value="' . $strGo . '" /></noscript>' . "\n";
580 echo ' </form>' . "\n";
583 $table_list = ' <div>' . $strSelectADb . '</div>' . "\n";
586 // Displays the current database name and the list of tables it
588 echo "\n" . ' <hr noshade="noshade" />' . "\n\n";
589 echo $table_list_header;
591 echo "\n" . ' <hr noshade="noshade" />' . "\n";
594 // No light mode -> initialize some js variables for the
595 // expandible/collapsible stuff
599 <!-- Arrange collapsible
/expandable db
list at startup
-->
600 <script type
="text/javascript" language
="javascript1.2">
603 firstEl
= 'el1Parent';
604 firstInd
= nsGetIndex(firstEl
);
608 var expandedDb
= '<?php echo (empty($selected_db)) ? '' : 'el
' . $selected_db . 'Child
'; ?>';
613 } // end if... else... (light mode)
615 } // end if ($server > 1)
618 // Case where only one database has to be displayed
619 else if ($num_dbs == 1) {
621 $tables = @PMA_mysql_list_tables
($db);
622 $num_tables = ($tables) ? @mysql_numrows
($tables) : 0;
623 $common_url_query = PMA_generate_common_url($db);
625 $num_tables_disp = $num_tables;
627 $num_tables_disp = '-';
630 // Get additional infomation about tables for tooltip
631 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION
>= 32303
634 $tooltip_name = array();
635 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
636 while ($tmp = PMA_mysql_fetch_array($result)) {
637 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '');
638 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] ?
$tmp['Name'] : $tmp['Comment']);
640 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '')
641 . '(' . (isset($tmp['Rows']) ?
$tmp['Rows'] : '0') . ' ' . $strRows . ')';
645 // garvin: Get comments from PMA comments table
647 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
648 $tmp_db_tooltip = PMA_getComments($db);
649 if (is_array($tmp_db_tooltip)) {
650 $db_tooltip = implode(' ', $tmp_db_tooltip);
655 // Displays the database name
656 if (!$cfg['LeftFrameLight']) {
657 $on_mouse = (($cfg['LeftPointerColor'] == '') ?
'' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el2\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el2\', \'' . $cfg['LeftBgColor'] . '\')}"');
660 echo ' <div id="el2Parent" class="parent"' . $on_mouse . '>';
662 if (!empty($num_tables)) {
665 <nobr
><a
class="item" href
="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>" onclick
="if (capable) {expandBase('el2', true); return false} else {return true}">
666 <img name
="imEx" id
="el2Img" src
="images/plus.png" border
="0" width
="9" height
="9" alt
="+" /></a
>
671 <nobr
><img name
="imEx" src
="images/minus.png" border
="0" width
="9" height
="9" alt
="-" />
676 <a
class="item" href
="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>" title
="<?php echo ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db) : htmlspecialchars($db_tooltip)); ?>" onclick
="if (capable) {expandBase('el2', false)}">
677 <span
class="heada"><?php
echo ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
'<i>' . htmlspecialchars($db_tooltip) . '</i>' : htmlspecialchars($db)); ?
><bdo dir
="<?php echo($text_dir); ?>"> 
; 
;</bdo
></span
><span
class="headaCnt">(<?php
echo $num_tables_disp; ?
>)</span
></a
></nobr
>
680 <div id
="el2Child" class="child" style
="margin-bottom: 5px"<?php
echo $on_mouse; ?
>>
685 <div id
="el2Parent" class="parent">
686 <nobr
><a
class="item" href
="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>">
687 <span
class="heada"><?php
echo ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
htmlspecialchars($db_tooltip) : htmlspecialchars($db)); ?
><bdo dir
="<?php echo($text_dir); ?>"> 
; 
;</bdo
></span
><span
class="headaCnt">(<?php
echo $num_tables_disp; ?
>)</span
></a
></nobr
>
689 <div id
="el2Child" class="child" style
="margin-bottom: 5px">
693 // Displays the list of tables from the current database
694 $tablestack = array();
695 for ($j = 0; $j < $num_tables; $j++
) {
696 $table = PMA_mysql_tablename($tables, $j);
697 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
698 ?
htmlentities($tooltip_name[$table])
700 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
701 ?
htmlentities($tooltip[$table])
703 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
705 if ($cfg['LeftFrameLight']) {
708 <nobr
><a target
="phpmain<?php echo $hash; ?>" href
="sql.php?<?php echo $common_url_query; ?>&table=<?php echo urlencode($table); ?>&sql_query=<?php echo (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))); ?>&pos=0&goto=<?php echo $cfg['DefaultTabTable']; ?>" title
="<?php echo $strBrowse . ': ' . $url_title; ?>">
709 <img src
="images/button_smallbrowse.png" width
="10" height
="10" border
="0" alt
="<?php echo $strBrowse . ': ' . $url_title; ?>" /></a
><bdo dir
="<?php echo $text_dir; ?>"> 
;</bdo
>
710 <a
class="tblItem" id
="tbl_<?php echo md5($table); ?>" title
="<?php echo $url_title; ?>" target
="phpmain<?php echo $hash; ?>" href
="<?php echo $cfg['DefaultTabTable']; ?>?<?php echo $common_url_query; ?>&table=<?php echo urlencode($table); ?>">
711 <?php
echo ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)); ?
></a
></nobr
><br
/>
714 $list_item = '<a target="phpmain' . $hash . '" href="sql.php?' . $common_url_query . '&table=' . urlencode($table) . '&sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ?
urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&pos=0&goto=' . $cfg['DefaultTabTable'] . '" title="' . $strBrowse . ': ' . $url_title . '">';
715 $list_item .= '<img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" /></a>';
716 $list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n";
717 $list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">';
718 $list_item .= ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)) . '</a></nobr><br />';
720 // garvin: Check whether to display nested sets
721 if (!empty($cfg['LeftFrameTableSeparator'])) {
722 $_table = explode($cfg['LeftFrameTableSeparator'], str_replace('\'', '\\\'',$table));
723 if (is_array($_table)) {
724 foreach($_table AS $key => $val) {
726 $_table[$key] = '__protected__';
730 unset($_table[count($_table)-1]);
731 $_table = PMA_reduceNest($_table);
733 $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $table) . '\';';
734 $eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . str_replace('\'', '\\\'', $list_item) . '\';';
737 $tablestack['']['pma_name'][] = $table;
738 $tablestack['']['pma_list_item'][] = $list_item;
741 $tablestack['']['pma_name'][] = $table;
742 $tablestack['']['pma_list_item'][] = $list_item;
745 } // end for $j (tables list)
747 if (!$cfg['LeftFrameLight']) {
748 PMA_nestedSet('1', $tablestack);
751 <!-- Arrange collapsible
/expandable db
list at startup
-->
752 <script type
="text/javascript" language
="javascript1.2">
755 firstEl
= 'el1Parent';
756 firstInd
= nsGetIndex(firstEl
);
760 var expandedDb
= '<?php echo (empty($selected_db)) ? '' : 'el
' . $selected_db . 'Child
'; ?>';
769 } // end if ($num_dbs == 1)
772 // Case where no database has to be displayed
775 echo '<p>' . $strNoDatabases . '</p>';
776 } // end if ($num_dbs == 0)
785 * Close MySql connections
787 if (isset($dbh) && $dbh) {
790 if (isset($userlink) && $userlink) {
791 @mysql_close
($userlink);
796 * Sends bufferized data
798 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
799 && isset($ob_mode) && $ob_mode) {
800 PMA_outBufferPost($ob_mode);