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 include('./libraries/bookmark.lib.php3');
35 require('./libraries/relation.lib.php3');
36 $cfgRelation = PMA_getRelationsParam();
38 function PMA_reduceNest($_table) {
40 if ($GLOBALS['cfg']['LeftFrameTableLevel'] > 0) {
41 $max = $GLOBALS['cfg']['LeftFrameTableLevel'];
42 $temp_table = $_table;
45 for ($ti = 0; $ti < $max; $ti++
) {
46 if (isset($temp_table[$ti])) {
47 $new_table[$ti] = $temp_table[$ti];
48 unset($temp_table[$ti]);
59 function PMA_indent($spaces) {
61 for ($i = 0; $i <= $spaces; $i++
) {
68 /* DEBUGGING ONLY - REMOVE WHEN PATCH ACCEPTED
72 function functioncalls($name, $args, $array) {
73 $GLOBALS['functioncalls'] .= $name . "\n------------------------\n";
74 foreach($array AS $xkey => $key) {
75 $defvals = explode(':' , $key);
78 $val = (isset($args[$xkey]) ? $args[$xkey] : $defvals[1]);
80 $GLOBALS['functioncalls'] .= $key . "\n";
81 foreach($val AS $skey => $sval) {
82 if (!is_array($val)) {
83 $GLOBALS['functioncalls'] .= "\t" . $skey . "\n\t\t" . stripslashes(var_export($sval)) . "\n";
85 $GLOBALS['functioncalls'] .= "\t" . $skey . "\n\t\t[ARRAY]\n";
89 $GLOBALS['functioncalls'] .= $key . "\n\t" . stripslashes(var_export($val, true)) . "\n";
93 $GLOBALS['functioncalls'] .= "\n\n";
99 function PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val, $childout = true) {
100 /* DEBUGGING ONLY - REMOVE WHEN PATCH ACCEPTED
101 $args = func_get_args();
102 functioncalls('PMA_nestedSetHeaderParent', $args, array('baseid', 'key','keyhistory','indent','indent_level','val','childout:true'));
106 $id = eregi_replace('[^a-z0-9]*', '', $baseid . $keyhistory . $key) . $indent;
108 $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'] . '\')}"');
111 if (count($countarray) == 2 && isset($countarray['pma_name']) && isset($countarray['pma_list_item'])) {
112 $counter = count($countarray['pma_name']);
114 unset($countarray['pma_name']);
115 if (count($countarray) > 1) {
116 unset($countarray['pma_list_item']);
118 $counter = count($countarray);
122 echo PMA_indent($indent * 5) . '<div id="el' . $id . 'Parent" class="parent"' . $on_mouse . '>' . "\n";
123 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}">';
124 echo '<img name="imEx" id="el' . $id . 'Img" src="images/plus.png" border="0" width="9" height="9" alt="+" /></a>' . "\n";
125 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";
126 echo PMA_indent($indent * 5) . '</div><id class="PMA_nestedSetHeaderParent">' . "\n";
130 echo PMA_indent($indent * 5) . '<div id="el' . $id . 'Child" class="child" ' . $on_mouse . '>' . "\n";
134 function PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent_level, $headerOut, $firstGroup = false, $firstGroupClose = true) {
135 /* DEBUGGING ONLY - REMOVE WHEN PATCH ACCEPTED
136 $args = func_get_args();
137 functioncalls('PMA_nestedSetHeader', $args, array('baseid', 'tablestack','keyhistory','indent','indent_level','headerOut','firstGroup:false'));
140 PMA_nestedSetHeaderParent($baseid, $firstGroup, $keyhistory, $indent, $indent_level, $tablestack);
144 while(list($key, $val) = each($tablestack)) {
145 if ($key != 'pma_name' && $key != 'pma_list_item') {
147 PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val);
150 if (isset($val['pma_name']) && isset($val['pma_list_item']) && count($val) == 2) {
151 PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, false, ($indent +
1));
153 PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, true, ($indent +
1));
157 echo PMA_indent($indent * 5) . '</div><id class="PMA_nestedSetHeader">' . "\n";
162 if ($firstGroup && $firstGroupClose) {
163 echo PMA_indent($indent * 4) . '</div><id class="PMA_nestedSetHeader2">' . "\n";
164 } elseif ($firstGroup) {
165 echo PMA_indent($indent * 4) . '<id spacer="div omitted" class="PMA_nestedSetHeader2">' . "\n";
169 function PMA_nestedSet($baseid, $tablestack, $key = '__protected__', $keyhistory = '', $headerOut = false, $indent = 1) {
170 /* DEBUGGING ONLY - REMOVE WHEN PATCH ACCEPTED
171 $args = func_get_args();
172 functioncalls('PMA_nestedSet', $args, array('baseid', 'tablestack', 'key:__protected__', 'keyhistory:\'\'', 'headerOut:false', 'indent:1'));
175 if ($keyhistory == '' && $key != '__protected__') {
181 if (isset($tablestack)
182 && isset($tablestack['pma_name'])
183 && isset($tablestack['pma_list_item'])) {
185 if (count($tablestack) > 1 && !empty($key) && isset($tablestack['pma_name']) && isset($tablestack['pma_list_item']) && $indent == 1) {
186 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, ($indent+
1), $indent_level, $headerOut, $key, false);
190 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent_level, $headerOut);
195 $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'] . '\')}"');
198 while(list($tkey, $tval) = each($tablestack['pma_name'])) {
200 echo PMA_indent($indent * 5) . '<nobr><img src="images/spacer.gif" border="0" width="' . (($indent+
$extra_indent) * $indent_level) . '" height="9" alt="" />';
201 $items = explode("\n", $tablestack['pma_list_item'][$tkey]);
202 while(list($ikey, $ival) = each($items)) {
204 echo PMA_indent(($indent * 5)) . $ival;
212 echo PMA_indent($indent * 5) . '</div><id space="putting omitted div" class="PMA_nestedSet2">';
215 } elseif (is_array($tablestack)) {
216 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, (($key == '__protected__' && $indent == 1 )?
($indent-1) : ($indent +
1)), $indent_level, $headerOut, (($key == '__protected__' && $indent == 1) ||
($indent > 1) ?
false : $key));
222 * Get the list and number of available databases.
223 * Skipped if no server selected: in this case no database should be displayed
224 * before the user choose among available ones at the welcome screen.
227 PMA_availableDatabases(); // this function is defined in "common.lib.php3"
233 // garvin: For re-usability, moved http-headers
234 // to a seperate file. It can now be included by header.inc.php3,
235 // queryframe.php3, querywindow.php3.
237 include('./libraries/header_http.inc.php3');
242 // Gets the font sizes to use
245 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
246 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
247 <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; ?>">
250 <title
>phpMyAdmin
</title
>
251 <meta http
-equiv
="Content-Type" content
="text/html; charset=<?php echo $charset; ?>" />
252 <base
<?php
if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?
> target
="phpmain<?php echo $hash; ?>" />
254 <script type
="text/javascript" language
="javascript">
257 if (isset($lightm_db) && !empty($lightm_db)) {
259 window
.parent
.frames
['phpmain<?php echo $hash; ?>'].location
.replace('./<?php echo $cfg['DefaultTabDatabase
'] . '?
' . PMA_generate_common_url($db, '', '&');?>');
261 } elseif (isset($lightm_db)) {
263 window
.parent
.frames
['phpmain<?php echo $hash; ?>'].location
.replace('./main.php3?<?php echo PMA_generate_common_url('', '', '&');?>');
271 // Expandable/collapsible databases list is only used if there is more than one
272 // database to display
273 if (($num_dbs > 1 ||
!empty($cfg['LeftFrameTableSeparator'])) && !$cfg['LeftFrameLight']) {
276 <!-- Collapsible tables
list scripts
-->
277 <script type
="text/javascript" language
="javascript">
279 var isDOM
= (typeof(document
.getElementsByTagName
) != 'undefined'
280 && typeof(document
.createElement
) != 'undefined')
282 var isIE4
= (typeof(document
.all
) != 'undefined'
283 && parseInt(navigator
.appVersion
) >= 4)
285 var isNS4
= (typeof(document
.layers
) != 'undefined')
287 var capable
= (isDOM || isIE4 || isNS4
)
289 // Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant
291 if (typeof(window
.opera
) != 'undefined') {
294 else if (typeof(navigator
.userAgent
) != 'undefined') {
295 var browserName
= ' ' + navigator
.userAgent
.toLowerCase();
296 if (browserName
.indexOf('konqueror') > 0) {
299 } // end if... else if...
302 var isServer
= <?php
echo ($server > 0) ?
'true' : 'false'; ?
>;
304 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 +
'" />');
308 <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" />
311 <script src
="libraries/left.js" type
="text/javascript" language
="javascript1.2"></script
>
313 } // end if ($num_dbs > 1)
315 else if ($num_dbs == 1) {
318 <link rel
="stylesheet" type
="text/css" href
="./css/phpmyadmin.css.php3?js_frame=left&js_capable=0&js_isDOM=0&js_isIE4=0" />
320 } // end if ($num_dbs == 1)
325 <link rel
="stylesheet" type
="text/css" href
="./css/phpmyadmin.css.php3?js_frame=left&num_dbs=0" />
327 } // end if ($num_dbs < 1)
333 <body bgcolor
="<?php echo $cfg['LeftBgColor']; ?>">
336 if ($cfg['LeftDisplayLogo']) {
338 <!-- phpMyAdmin logo
-->
339 <a href
="http://www.phpmyadmin.net" target
="_blank"><img src
="./images/pma_logo.png" width
="88" height
="31" border
="0" alt
="phpMyAdmin" /></a
>
344 <!-- Link to the welcome page
-->
345 <div id
="el1Parent" class="parent" style
="margin-bottom: 5px">
346 <nobr
><a
class="item" href
="main.php3?<?php echo PMA_generate_common_url(); ?>"><span
class="heada"><b
><?php
echo $strHome; ?
></b
></span
></a
></nobr
>
350 <!-- Databases
and tables
list -->
352 // Don't display expansible/collapsible database info if:
353 // 1. $server == 0 (no server selected)
354 // This is the case when there are multiple servers and
355 // '$cfg['ServerDefault'] = 0' is set. In that case, we want the welcome
356 // screen to appear with no database info displayed.
357 // 2. there is only one database available (ie either only one database exists
358 // or $cfg['Servers']['only_db'] is defined and is not an array)
359 // In this case, the database should not be collapsible/expandable
362 // Light mode -> beginning of the select combo for databases
363 // Note: When javascript is active, the frameset will be changed from
364 // within left.php3. With no JS (<noscript>) the whole frameset will
365 // be rebuilt with the new target frame.
366 if ($cfg['LeftFrameLight']) {
368 <script type
="text/javascript" language
="javascript">
369 document
.writeln('<form method="post" action="left.php3" name="left" target="nav">');
372 <form method
="post" action
="index.php3" name
="left" target
="_parent">
375 echo PMA_generate_common_hidden_inputs();
376 echo ' <input type="hidden" name="hash" value="' . $hash . '" />' . "\n";
377 echo ' <select name="lightm_db" onchange="this.form.submit()">' . "\n";
378 echo ' <option value="">(' . $strDatabases . ') ...</option>' . "\n";
380 $table_list_header = '';
386 // Gets the tables list per database
387 for ($i = 0; $i < $num_dbs; $i++
) {
390 if (!empty($db_start) && $db == $db_start) {
393 $tables = @PMA_mysql_list_tables
($db);
394 $num_tables = ($tables) ? @mysql_numrows
($tables) : 0;
395 $common_url_query = PMA_generate_common_url($db);
397 $num_tables_disp = $num_tables;
399 $num_tables_disp = '-';
402 // Get additional information about tables for tooltip
403 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION
>= 32303
405 && (!$cfg['LeftFrameLight'] ||
$selected_db == $j)) {
407 $tooltip_name = array();
408 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
409 while ($tmp = PMA_mysql_fetch_array($result)) {
410 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '');
411 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] ?
$tmp['Name'] : $tmp['Comment']);
413 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '')
414 . '(' . (isset($tmp['Rows']) ?
$tmp['Rows'] : '0') . ' ' . $strRows . ')';
418 // garvin: Get comments from PMA comments table
420 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
421 $tmp_db_tooltip = PMA_getComments($db);
422 if (is_array($tmp_db_tooltip)) {
423 $db_tooltip = implode(' ', $tmp_db_tooltip);
427 // No light mode -> displays the expandible/collapsible db list
428 if ($cfg['LeftFrameLight'] == FALSE) {
430 // Displays the database name
431 $on_mouse = (($cfg['LeftPointerColor'] == '') ?
'' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftBgColor'] . '\')}"');
434 echo ' <div id="el' . $j . 'Parent" class="parent"' . $on_mouse . '>';
436 if (!empty($num_tables)) {
439 <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}">
440 <img name
="imEx" id
="el<?php echo $j; ?>Img" src
="images/plus.png" border
="0" width
="9" height
="9" alt
="+" /></a
>
445 <nobr
><img name
="imEx" src
="images/minus.png" border
="0" width
="9" height
="9" alt
="-" />
450 <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)}">
451 <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
>
454 <div id
="el<?php echo $j;?>Child" class="child" style
="margin-bottom: 5px"<?php
echo $on_mouse; ?
>>
456 // Displays the list of tables from the current database
457 $tablestack = array();
458 for ($t = 0; $t < $num_tables; $t++
) {
459 $table = PMA_mysql_tablename($tables, $t);
460 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
461 ?
htmlspecialchars($tooltip_name[$table])
463 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
464 ?
htmlspecialchars($tooltip[$table])
467 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
469 $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 . '">';
470 $list_item .= '<img src="images/browse.png" width="8" height="8" border="0" alt="' . $strBrowse . ': ' . $url_title . '" /></a>';
471 $list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n";
472 $list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">';
473 $list_item .= ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n";
475 // garvin: Check whether to display nested sets
476 if (!empty($cfg['LeftFrameTableSeparator'])) {
477 $_table = explode($cfg['LeftFrameTableSeparator'], str_replace('\'', '\\\'',$table));
478 if (is_array($_table)) {
480 while(list($key, $val) = each($_table)) {
482 $_table[$key] = '__protected__';
486 unset($_table[count($_table)-1]);
487 $_table = PMA_reduceNest($_table);
489 $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $table) . '\';';
490 $eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . str_replace('\'', '\\\'', $list_item) . '\';';
493 $tablestack['__protected__']['pma_name'][] = $table;
494 $tablestack['__protected__']['pma_list_item'][] = $list_item;
497 $tablestack['__protected__']['pma_name'][] = $table;
498 $tablestack['__protected__']['pma_list_item'][] = $list_item;
500 } // end for $t (tables list)
502 PMA_nestedSet($j, $tablestack);
510 // Light mode -> displays the select combo with databases names and the
511 // list of tables contained in the current database
515 // Builds the databases' names list
516 if (!empty($db_start) && $db == $db_start) {
517 // Gets the list of tables from the current database
518 for ($t = 0; $t < $num_tables; $t++
) {
519 $table = PMA_mysql_tablename($tables, $t);
520 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
521 ?
htmlentities($tooltip[$table])
523 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
524 ?
htmlentities($tooltip_name[$table])
527 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
529 $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";
530 $table_list .= ' <img src="images/browse.png" width="8" height="8" border="0" alt="' . $strBrowse . ': ' . $url_title . '" title="' . $strBrowse . ': ' . $url_title . '" /></a><bdo dir="' . $text_dir . '"> </bdo>' . "\n";
531 if (PMA_USR_BROWSER_AGENT
== 'IE') {
532 $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";
534 $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";
536 } // end for $t (tables list)
539 $table_list = ' <br /><br />' . "\n"
540 . ' <div>' . $strNoTablesFound . '</div>' . "\n";
542 $selected = ' selected="selected"';
544 $table_list_header .= ' <a class="item" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabDatabase'] . '?' . $common_url_query . '">' . "\n";
545 $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";
548 } // end if... else...
550 if (!empty($num_tables)) {
551 echo ' <option value="' . htmlspecialchars($db) . '"' . $selected . '>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (' . $num_tables . ')</option>' . "\n";
553 echo ' <option value="' . htmlspecialchars($db) . '"' . $selected . '>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (-)</option>' . "\n";
554 } // end if... else...
556 } // end if (light mode)
558 } // end for $i (db list)
560 // Light mode -> end of the select combo for databases and table list for
561 // the current database
562 if ($cfg['LeftFrameLight']) {
563 echo ' </select>' . "\n";
564 echo ' <noscript><input type="submit" name="Go" value="' . $strGo . '" /></noscript>' . "\n";
565 echo ' </form>' . "\n";
568 $table_list = ' <div>' . $strSelectADb . '</div>' . "\n";
571 // Displays the current database name and the list of tables it
573 echo "\n" . ' <hr noshade="noshade" />' . "\n\n";
574 echo $table_list_header;
576 echo "\n" . ' <hr noshade="noshade" />' . "\n";
579 // No light mode -> initialize some js variables for the
580 // expandible/collapsible stuff
584 <!-- Arrange collapsible
/expandable db
list at startup
-->
585 <script type
="text/javascript" language
="javascript1.2">
588 firstEl
= 'el1Parent';
589 firstInd
= nsGetIndex(firstEl
);
593 var expandedDb
= '<?php echo (empty($selected_db)) ? '' : 'el
' . $selected_db . 'Child
'; ?>';
598 } // end if... else... (light mode)
600 } // end if ($server > 1)
603 // Case where only one database has to be displayed
604 else if ($num_dbs == 1) {
606 $tables = @PMA_mysql_list_tables
($db);
607 $num_tables = ($tables) ? @mysql_numrows
($tables) : 0;
608 $common_url_query = PMA_generate_common_url($db);
610 $num_tables_disp = $num_tables;
612 $num_tables_disp = '-';
615 // Get additional infomation about tables for tooltip
616 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION
>= 32303
619 $tooltip_name = array();
620 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
621 while ($tmp = PMA_mysql_fetch_array($result)) {
622 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '');
623 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] ?
$tmp['Name'] : $tmp['Comment']);
625 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '')
626 . '(' . (isset($tmp['Rows']) ?
$tmp['Rows'] : '0') . ' ' . $strRows . ')';
630 // garvin: Get comments from PMA comments table
632 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
633 $tmp_db_tooltip = PMA_getComments($db);
634 if (is_array($tmp_db_tooltip)) {
635 $db_tooltip = implode(' ', $tmp_db_tooltip);
640 // Displays the database name
641 if (!$cfg['LeftFrameLight']) {
642 $on_mouse = (($cfg['LeftPointerColor'] == '') ?
'' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el2\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el2\', \'' . $cfg['LeftBgColor'] . '\')}"');
645 echo ' <div id="el2Parent" class="parent"' . $on_mouse . '>';
647 if (!empty($num_tables)) {
650 <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}">
651 <img name
="imEx" id
="el2Img" src
="images/plus.png" border
="0" width
="9" height
="9" alt
="+" /></a
>
656 <nobr
><img name
="imEx" src
="images/minus.png" border
="0" width
="9" height
="9" alt
="-" />
661 <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)}">
662 <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
>
665 <div id
="el2Child" class="child" style
="margin-bottom: 5px"<?php
echo $on_mouse; ?
>>
670 <div id
="el2Parent" class="parent">
671 <nobr
><a
class="item" href
="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>">
672 <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
>
674 <div id
="el2Child" class="child" style
="margin-bottom: 5px">
678 // Displays the list of tables from the current database
679 $tablestack = array();
680 for ($j = 0; $j < $num_tables; $j++
) {
681 $table = PMA_mysql_tablename($tables, $j);
682 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
683 ?
htmlentities($tooltip_name[$table])
685 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
686 ?
htmlentities($tooltip[$table])
688 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
690 if ($cfg['LeftFrameLight']) {
693 <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; ?>">
694 <img src
="images/browse.png" width
="8" height
="8" border
="0" alt
="<?php echo $strBrowse . ': ' . $url_title; ?>" /></a
><bdo dir
="<?php echo $text_dir; ?>"> 
;</bdo
>
695 <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); ?>">
696 <?php
echo ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)); ?
></a
></nobr
><br
/>
699 $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 . '">';
700 $list_item .= '<img src="images/browse.png" width="8" height="8" border="0" alt="' . $strBrowse . ': ' . $url_title . '" /></a>';
701 $list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n";
702 $list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">';
703 $list_item .= ($alias != '' && $cfg['ShowTooltipAliasTB'] ?
$alias : htmlspecialchars($table)) . '</a></nobr><br />';
705 // garvin: Check whether to display nested sets
706 if (!empty($cfg['LeftFrameTableSeparator'])) {
707 $_table = explode($cfg['LeftFrameTableSeparator'], $table);
708 if (is_array($_table)) {
710 while(list($key, $val) = each($_table)) {
712 $_table[$key] = '__protected__';
715 unset($_table[count($_table)-1]);
716 $_table = PMA_reduceNest($_table);
718 $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . $table . '\';';
719 $eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . $list_item . '\';';
722 $tablestack['__protected__']['pma_name'][] = $table;
723 $tablestack['__protected__']['pma_list_item'][] = $list_item;
726 $tablestack['__protected__']['pma_name'][] = $table;
727 $tablestack['__protected__']['pma_list_item'][] = $list_item;
730 } // end for $j (tables list)
732 if (!$cfg['LeftFrameLight']) {
733 PMA_nestedSet('1', $tablestack);
736 <!-- Arrange collapsible
/expandable db
list at startup
-->
737 <script type
="text/javascript" language
="javascript1.2">
740 firstEl
= 'el1Parent';
741 firstInd
= nsGetIndex(firstEl
);
745 var expandedDb
= '<?php echo (empty($selected_db)) ? '' : 'el
' . $selected_db . 'Child
'; ?>';
754 } // end if ($num_dbs == 1)
757 // Case where no database has to be displayed
760 echo '<p>' . $strNoDatabases . '</p>';
761 } // end if ($num_dbs == 0)
770 * Close MySql connections
772 if (isset($dbh) && $dbh) {
775 if (isset($userlink) && $userlink) {
776 @mysql_close
($userlink);
781 * Sends bufferized data
783 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
784 && isset($ob_mode) && $ob_mode) {
785 PMA_outBufferPost($ob_mode);