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('./libraries/grab_globals.lib.php3');
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('./libraries/common.lib.php3');
26 require('./libraries/ob.lib.php3');
28 $ob_mode = PMA_outBufferModeGet();
30 PMA_outBufferPre($ob_mode);
34 PMA_checkParameters(array('hash'));
36 include('./libraries/bookmark.lib.php3');
37 require('./libraries/relation.lib.php3');
38 $cfgRelation = PMA_getRelationsParam();
40 function PMA_reduceNest($_table) {
42 if ($GLOBALS['cfg']['LeftFrameTableLevel'] > 0) {
43 $max = $GLOBALS['cfg']['LeftFrameTableLevel'];
44 $temp_table = $_table;
47 for ($ti = 0; $ti < $max; $ti++
) {
48 if (isset($temp_table[$ti])) {
49 $new_table[$ti] = $temp_table[$ti];
50 unset($temp_table[$ti]);
61 function PMA_indent($spaces) {
63 for ($i = 0; $i <= $spaces; $i++
) {
70 function PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val, $childout = true) {
72 $id = eregi_replace('[^a-z0-9]*', '', $baseid . $keyhistory . $key) . $indent;
74 $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'] . '\')}"');
77 if (count($countarray) == 2 && isset($countarray['pma_name']) && isset($countarray['pma_list_item'])) {
78 $counter = count($countarray['pma_name']);
80 unset($countarray['pma_name']);
81 if (count($countarray) > 1) {
82 unset($countarray['pma_list_item']);
84 $counter = count($countarray);
88 echo PMA_indent($indent * 5) . '<div id="el' . $id . 'Parent" class="parent"' . $on_mouse . '>' . "\n";
89 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}">';
90 echo '<img name="imEx" id="el' . $id . 'Img" src="images/plus.png" border="0" width="9" height="9" alt="+" /></a>' . "\n";
91 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";
92 echo PMA_indent($indent * 5) . '</div><id class="PMA_nestedSetHeaderParent">' . "\n";
96 echo PMA_indent($indent * 5) . '<div id="el' . $id . 'Child" class="child" ' . $on_mouse . '>' . "\n";
100 function PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent_level, $headerOut, $firstGroup = false, $firstGroupClose = true) {
102 PMA_nestedSetHeaderParent($baseid, $firstGroup, $keyhistory, $indent, $indent_level, $tablestack);
106 while(list($key, $val) = each($tablestack)) {
107 if ($key != 'pma_name' && $key != 'pma_list_item') {
109 PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val);
112 if (isset($val['pma_name']) && isset($val['pma_list_item']) && count($val) == 2) {
113 PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, false, ($indent +
1));
115 PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, true, ($indent +
1));
119 echo PMA_indent($indent * 5) . '</div><id class="PMA_nestedSetHeader">' . "\n";
124 if ($firstGroup && $firstGroupClose) {
125 echo PMA_indent($indent * 4) . '</div><id class="PMA_nestedSetHeader2">' . "\n";
126 } elseif ($firstGroup) {
127 echo PMA_indent($indent * 4) . '<id spacer="div omitted" class="PMA_nestedSetHeader2">' . "\n";
131 function PMA_nestedSet($baseid, $tablestack, $key = '__protected__', $keyhistory = '', $headerOut = false, $indent = 1) {
133 if ($keyhistory == '' && $key != '__protected__') {
139 if (isset($tablestack)
140 && isset($tablestack['pma_name'])
141 && isset($tablestack['pma_list_item'])) {
143 if (count($tablestack) > 1 && !empty($key) && isset($tablestack['pma_name']) && isset($tablestack['pma_list_item']) && $indent == 1) {
144 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, ($indent+
1), $indent_level, $headerOut, $key, false);
148 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent_level, $headerOut);
153 $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'] . '\')}"');
156 while(list($tkey, $tval) = each($tablestack['pma_name'])) {
158 echo PMA_indent($indent * 5) . '<nobr><img src="images/spacer.gif" border="0" width="' . (($indent+
$extra_indent) * $indent_level) . '" height="9" alt="" />';
159 $items = explode("\n", $tablestack['pma_list_item'][$tkey]);
160 while(list($ikey, $ival) = each($items)) {
162 echo PMA_indent(($indent * 5)) . $ival;
170 echo PMA_indent($indent * 5) . '</div><id space="putting omitted div" class="PMA_nestedSet2">';
173 } elseif (is_array($tablestack)) {
174 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, (($key == '__protected__' && $indent == 1 )?
($indent-1) : ($indent +
1)), $indent_level, $headerOut, (($key == '__protected__' && $indent == 1) ||
($indent > 1) ?
false : $key));
180 * Get the list and number of available databases.
181 * Skipped if no server selected: in this case no database should be displayed
182 * before the user choose among available ones at the welcome screen.
185 PMA_availableDatabases(); // this function is defined in "common.lib.php3"
191 // garvin: For re-usability, moved http-headers
192 // to a seperate file. It can now be included by header.inc.php3,
193 // queryframe.php3, querywindow.php3.
195 include('./libraries/header_http.inc.php3');
200 // Gets the font sizes to use
203 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
204 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
205 <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; ?>">
208 <title
>phpMyAdmin
</title
>
209 <meta http
-equiv
="Content-Type" content
="text/html; charset=<?php echo $charset; ?>" />
210 <base
<?php
if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?
> target
="phpmain<?php echo $hash; ?>" />
212 <script type
="text/javascript" language
="javascript">
215 if (isset($lightm_db) && !empty($lightm_db)) {
217 window
.parent
.frames
['phpmain<?php echo $hash; ?>'].location
.replace('./<?php echo $cfg['DefaultTabDatabase
'] . '?
' . PMA_generate_common_url($db, '', '&');?>');
219 } elseif (isset($lightm_db)) {
221 window
.parent
.frames
['phpmain<?php echo $hash; ?>'].location
.replace('./main.php3?<?php echo PMA_generate_common_url('', '', '&');?>');
229 // Expandable/collapsible databases list is only used if there is more than one
230 // database to display
231 if (($num_dbs > 1 ||
!empty($cfg['LeftFrameTableSeparator'])) && !$cfg['LeftFrameLight']) {
234 <!-- Collapsible tables
list scripts
-->
235 <script type
="text/javascript" language
="javascript">
237 var isDOM
= (typeof(document
.getElementsByTagName
) != 'undefined'
238 && typeof(document
.createElement
) != 'undefined')
240 var isIE4
= (typeof(document
.all
) != 'undefined'
241 && parseInt(navigator
.appVersion
) >= 4)
243 var isNS4
= (typeof(document
.layers
) != 'undefined')
245 var capable
= (isDOM || isIE4 || isNS4
)
247 // Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant
249 if (typeof(window
.opera
) != 'undefined') {
252 else if (typeof(navigator
.userAgent
) != 'undefined') {
253 var browserName
= ' ' + navigator
.userAgent
.toLowerCase();
254 if (browserName
.indexOf('konqueror') > 0) {
257 } // end if... else if...
260 var isServer
= <?php
echo ($server > 0) ?
'true' : 'false'; ?
>;
262 document
.writeln('<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php3?lang=<?php echo $lang; ?>&js_frame=left&js_capable=' + capable +
'&js_isDOM=' + isDOM +
'&js_isIE4=' + isIE4 +
'" />');
266 <link rel
="stylesheet" type
="text/css" href
="./css/phpmyadmin.css.php3?lang=<?php echo $lang; ?>&js_frame=left&js_capable=0&js_isDOM=0&js_isIE4=0" />
269 <script src
="libraries/left.js" type
="text/javascript" language
="javascript1.2"></script
>
271 } // end if ($num_dbs > 1)
273 else if ($num_dbs == 1) {
276 <link rel
="stylesheet" type
="text/css" href
="./css/phpmyadmin.css.php3?js_frame=left&js_capable=0&js_isDOM=0&js_isIE4=0" />
278 } // end if ($num_dbs == 1)
283 <link rel
="stylesheet" type
="text/css" href
="./css/phpmyadmin.css.php3?js_frame=left&num_dbs=0" />
285 } // end if ($num_dbs < 1)
291 <body bgcolor
="<?php echo $cfg['LeftBgColor']; ?>">
294 if ($cfg['LeftDisplayLogo']) {
296 <!-- phpMyAdmin logo
-->
297 <a href
="http://www.phpmyadmin.net" target
="_blank"><img src
="./images/pma_logo.png" width
="88" height
="31" border
="0" alt
="phpMyAdmin" /></a
>
301 if ($cfg['LeftDisplayServers']) {
303 <form method
="post" action
="index.php3" target
="_parent">
304 <select name
="server" onchange
="this.form.submit();">
307 reset($cfg['Servers']);
308 while (list($key, $val) = each($cfg['Servers'])) {
309 if (!empty($val['host'])) {
310 echo ' <option value="' . $key . '"';
311 if (!empty($server) && ($server == $key)) {
312 echo ' selected="selected"';
315 if (!empty($val['verbose'])) {
316 echo $val['verbose'];
319 if (!empty($val['port'])) {
320 echo ':' . $val['port'];
322 // loic1: skip this because it's not a so good idea to display
323 // sockets used to everybody
324 // if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) {
325 // echo ':' . $val['socket'];
328 // loic1: if 'only_db' is an array and there is more than one
329 // value, displaying such informations may not be a so good
331 if (!empty($val['only_db'])) {
332 echo ' - ' . (is_array($val['only_db']) ?
implode(', ', $val['only_db']) : $val['only_db']);
334 if (!empty($val['user']) && ($val['auth_type'] == 'config')) {
335 echo ' (' . $val['user'] . ')';
337 echo ' </option>' . "\n";
338 } // end if (!empty($val['host']))
342 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
343 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
344 <noscript
><input type
="submit" value
="<?php echo $strGo; ?>" /></noscript
>
350 <!-- Link to the welcome page
-->
351 <div id
="el1Parent" class="parent" style
="margin-bottom: 5px">
352 <nobr
><a
class="item" href
="main.php3?<?php echo PMA_generate_common_url(); ?>"><span
class="heada"><b
><?php
echo $strHome; ?
></b
></span
></a
></nobr
>
356 <!-- Databases
and tables
list -->
358 // Don't display expansible/collapsible database info if:
359 // 1. $server == 0 (no server selected)
360 // This is the case when there are multiple servers and
361 // '$cfg['ServerDefault'] = 0' is set. In that case, we want the welcome
362 // screen to appear with no database info displayed.
363 // 2. there is only one database available (ie either only one database exists
364 // or $cfg['Servers']['only_db'] is defined and is not an array)
365 // In this case, the database should not be collapsible/expandable
368 // Light mode -> beginning of the select combo for databases
369 // Note: When javascript is active, the frameset will be changed from
370 // within left.php3. With no JS (<noscript>) the whole frameset will
371 // be rebuilt with the new target frame.
372 if ($cfg['LeftFrameLight']) {
374 <script type
="text/javascript" language
="javascript">
375 document
.writeln('<form method="post" action="left.php3" name="left" target="nav">');
378 <form method
="post" action
="index.php3" name
="left" target
="_parent">
381 echo PMA_generate_common_hidden_inputs();
382 echo ' <input type="hidden" name="hash" value="' . $hash . '" />' . "\n";
383 echo ' <select name="lightm_db" onchange="this.form.submit()">' . "\n";
384 echo ' <option value="">(' . $strDatabases . ') ...</option>' . "\n";
386 $table_list_header = '';
392 // Gets the tables list per database
393 for ($i = 0; $i < $num_dbs; $i++
) {
396 if (!empty($db_start) && $db == $db_start) {
399 $tables = @PMA_mysql_list_tables
($db);
400 $num_tables = ($tables) ? @mysql_numrows
($tables) : 0;
401 $common_url_query = PMA_generate_common_url($db);
403 $num_tables_disp = $num_tables;
405 $num_tables_disp = '-';
408 // Get additional information about tables for tooltip
409 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION
>= 32303
411 && (!$cfg['LeftFrameLight'] ||
$selected_db == $j)) {
413 $tooltip_name = array();
414 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
415 while ($tmp = PMA_mysql_fetch_array($result)) {
416 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '');
417 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] ?
$tmp['Name'] : $tmp['Comment']);
419 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '')
420 . '(' . (isset($tmp['Rows']) ?
$tmp['Rows'] : '0') . ' ' . $strRows . ')';
424 // garvin: Get comments from PMA comments table
426 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
427 $tmp_db_tooltip = PMA_getComments($db);
428 if (is_array($tmp_db_tooltip)) {
429 $db_tooltip = implode(' ', $tmp_db_tooltip);
433 // No light mode -> displays the expandible/collapsible db list
434 if ($cfg['LeftFrameLight'] == FALSE) {
436 // Displays the database name
437 $on_mouse = (($cfg['LeftPointerColor'] == '') ?
'' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftBgColor'] . '\')}"');
440 echo ' <div id="el' . $j . 'Parent" class="parent"' . $on_mouse . '>';
442 if (!empty($num_tables)) {
445 <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}">
446 <img name
="imEx" id
="el<?php echo $j; ?>Img" src
="images/plus.png" border
="0" width
="9" height
="9" alt
="+" /></a
>
451 <nobr
><img name
="imEx" src
="images/minus.png" border
="0" width
="9" height
="9" alt
="-" />
456 <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)}">
457 <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
>
460 <div id
="el<?php echo $j;?>Child" class="child" style
="margin-bottom: 5px"<?php
echo $on_mouse; ?
>>
462 // Displays the list of tables from the current database
463 $tablestack = array();
464 for ($t = 0; $t < $num_tables; $t++
) {
465 $table = PMA_mysql_tablename($tables, $t);
466 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
467 ?
htmlspecialchars($tooltip_name[$table])
469 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
470 ?
htmlspecialchars($tooltip[$table])
473 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
475 $list_item = '<a target="phpmain' . $hash . '" href="sql.php3?' . $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 . '">';
476 $list_item .= '<img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" /></a>';
477 $list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n";
478 $list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">';
479 $list_item .= ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n";
481 // garvin: Check whether to display nested sets
482 if (!empty($cfg['LeftFrameTableSeparator'])) {
483 $_table = explode($cfg['LeftFrameTableSeparator'], str_replace('\'', '\\\'',$table));
484 if (is_array($_table)) {
486 while(list($key, $val) = each($_table)) {
488 $_table[$key] = '__protected__';
492 unset($_table[count($_table)-1]);
493 $_table = PMA_reduceNest($_table);
495 $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $table) . '\';';
496 $eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . str_replace('\'', '\\\'', $list_item) . '\';';
499 $tablestack['__protected__']['pma_name'][] = $table;
500 $tablestack['__protected__']['pma_list_item'][] = $list_item;
503 $tablestack['__protected__']['pma_name'][] = $table;
504 $tablestack['__protected__']['pma_list_item'][] = $list_item;
506 } // end for $t (tables list)
508 PMA_nestedSet($j, $tablestack);
516 // Light mode -> displays the select combo with databases names and the
517 // list of tables contained in the current database
521 // Builds the databases' names list
522 if (!empty($db_start) && $db == $db_start) {
523 // Gets the list of tables from the current database
524 for ($t = 0; $t < $num_tables; $t++
) {
525 $table = PMA_mysql_tablename($tables, $t);
526 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
527 ?
htmlentities($tooltip[$table])
529 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
530 ?
htmlentities($tooltip_name[$table])
533 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
535 $table_list .= ' <nobr><a target="phpmain' . $hash . '" href="sql.php3?' . $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";
536 $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";
537 if (PMA_USR_BROWSER_AGENT
== 'IE') {
538 $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";
540 $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";
542 } // end for $t (tables list)
545 $table_list = ' <br /><br />' . "\n"
546 . ' <div>' . $strNoTablesFound . '</div>' . "\n";
548 $selected = ' selected="selected"';
550 $table_list_header .= ' <a class="item" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabDatabase'] . '?' . $common_url_query . '">' . "\n";
551 $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";
554 } // end if... else...
556 if (!empty($num_tables)) {
557 echo ' <option value="' . htmlspecialchars($db) . '"' . $selected . '>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (' . $num_tables . ')</option>' . "\n";
559 echo ' <option value="' . htmlspecialchars($db) . '"' . $selected . '>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (-)</option>' . "\n";
560 } // end if... else...
562 } // end if (light mode)
564 } // end for $i (db list)
566 // Light mode -> end of the select combo for databases and table list for
567 // the current database
568 if ($cfg['LeftFrameLight']) {
569 echo ' </select>' . "\n";
570 echo ' <noscript><input type="submit" name="Go" value="' . $strGo . '" /></noscript>' . "\n";
571 echo ' </form>' . "\n";
574 $table_list = ' <div>' . $strSelectADb . '</div>' . "\n";
577 // Displays the current database name and the list of tables it
579 echo "\n" . ' <hr noshade="noshade" />' . "\n\n";
580 echo $table_list_header;
582 echo "\n" . ' <hr noshade="noshade" />' . "\n";
585 // No light mode -> initialize some js variables for the
586 // expandible/collapsible stuff
590 <!-- Arrange collapsible
/expandable db
list at startup
-->
591 <script type
="text/javascript" language
="javascript1.2">
594 firstEl
= 'el1Parent';
595 firstInd
= nsGetIndex(firstEl
);
599 var expandedDb
= '<?php echo (empty($selected_db)) ? '' : 'el
' . $selected_db . 'Child
'; ?>';
604 } // end if... else... (light mode)
606 } // end if ($server > 1)
609 // Case where only one database has to be displayed
610 else if ($num_dbs == 1) {
612 $tables = @PMA_mysql_list_tables
($db);
613 $num_tables = ($tables) ? @mysql_numrows
($tables) : 0;
614 $common_url_query = PMA_generate_common_url($db);
616 $num_tables_disp = $num_tables;
618 $num_tables_disp = '-';
621 // Get additional infomation about tables for tooltip
622 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION
>= 32303
625 $tooltip_name = array();
626 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
627 while ($tmp = PMA_mysql_fetch_array($result)) {
628 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '');
629 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] ?
$tmp['Name'] : $tmp['Comment']);
631 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '')
632 . '(' . (isset($tmp['Rows']) ?
$tmp['Rows'] : '0') . ' ' . $strRows . ')';
636 // garvin: Get comments from PMA comments table
638 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
639 $tmp_db_tooltip = PMA_getComments($db);
640 if (is_array($tmp_db_tooltip)) {
641 $db_tooltip = implode(' ', $tmp_db_tooltip);
646 // Displays the database name
647 if (!$cfg['LeftFrameLight']) {
648 $on_mouse = (($cfg['LeftPointerColor'] == '') ?
'' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el2\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el2\', \'' . $cfg['LeftBgColor'] . '\')}"');
651 echo ' <div id="el2Parent" class="parent"' . $on_mouse . '>';
653 if (!empty($num_tables)) {
656 <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}">
657 <img name
="imEx" id
="el2Img" src
="images/plus.png" border
="0" width
="9" height
="9" alt
="+" /></a
>
662 <nobr
><img name
="imEx" src
="images/minus.png" border
="0" width
="9" height
="9" alt
="-" />
667 <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)}">
668 <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
>
671 <div id
="el2Child" class="child" style
="margin-bottom: 5px"<?php
echo $on_mouse; ?
>>
676 <div id
="el2Parent" class="parent">
677 <nobr
><a
class="item" href
="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>">
678 <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
>
680 <div id
="el2Child" class="child" style
="margin-bottom: 5px">
684 // Displays the list of tables from the current database
685 $tablestack = array();
686 for ($j = 0; $j < $num_tables; $j++
) {
687 $table = PMA_mysql_tablename($tables, $j);
688 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
689 ?
htmlentities($tooltip_name[$table])
691 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
692 ?
htmlentities($tooltip[$table])
694 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
696 if ($cfg['LeftFrameLight']) {
699 <nobr
><a target
="phpmain<?php echo $hash; ?>" href
="sql.php3?<?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; ?>">
700 <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
>
701 <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); ?>">
702 <?php
echo ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)); ?
></a
></nobr
><br
/>
705 $list_item = '<a target="phpmain' . $hash . '" href="sql.php3?' . $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 . '">';
706 $list_item .= '<img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" /></a>';
707 $list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n";
708 $list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">';
709 $list_item .= ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)) . '</a></nobr><br />';
711 // garvin: Check whether to display nested sets
712 if (!empty($cfg['LeftFrameTableSeparator'])) {
713 $_table = explode($cfg['LeftFrameTableSeparator'], $table);
714 if (is_array($_table)) {
716 while(list($key, $val) = each($_table)) {
718 $_table[$key] = '__protected__';
721 unset($_table[count($_table)-1]);
722 $_table = PMA_reduceNest($_table);
724 $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . $table . '\';';
725 $eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . $list_item . '\';';
728 $tablestack['__protected__']['pma_name'][] = $table;
729 $tablestack['__protected__']['pma_list_item'][] = $list_item;
732 $tablestack['__protected__']['pma_name'][] = $table;
733 $tablestack['__protected__']['pma_list_item'][] = $list_item;
736 } // end for $j (tables list)
738 if (!$cfg['LeftFrameLight']) {
739 PMA_nestedSet('1', $tablestack);
742 <!-- Arrange collapsible
/expandable db
list at startup
-->
743 <script type
="text/javascript" language
="javascript1.2">
746 firstEl
= 'el1Parent';
747 firstInd
= nsGetIndex(firstEl
);
751 var expandedDb
= '<?php echo (empty($selected_db)) ? '' : 'el
' . $selected_db . 'Child
'; ?>';
760 } // end if ($num_dbs == 1)
763 // Case where no database has to be displayed
766 echo '<p>' . $strNoDatabases . '</p>';
767 } // end if ($num_dbs == 0)
776 * Close MySql connections
778 if (isset($dbh) && $dbh) {
781 if (isset($userlink) && $userlink) {
782 @mysql_close
($userlink);
787 * Sends bufferized data
789 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
790 && isset($ob_mode) && $ob_mode) {
791 PMA_outBufferPost($ob_mode);