00001 <?php
00002
00003
00004
00005
00010 require_once('./libraries/grab_globals.lib.php');
00011 if (isset($lightm_db) && !empty($lightm_db)) {
00012
00013
00014 $db = $lightm_db;
00015 }
00016
00017 if (!empty($db)) {
00018 $db_start = $db;
00019 }
00020
00021
00025 require_once('./libraries/common.lib.php');
00026 require_once('./libraries/ob.lib.php');
00027 if ($cfg['OBGzip']) {
00028 $ob_mode = PMA_outBufferModeGet();
00029 if ($ob_mode) {
00030 PMA_outBufferPre($ob_mode);
00031 }
00032 }
00033
00034
00035
00036
00037
00038
00039
00040 if (!isset($hash)) {
00041 $hash='';
00042 } else {
00043 $hash = PMA_sanitize($hash);
00044 }
00045
00046 require_once('./libraries/bookmark.lib.php');
00047 require_once('./libraries/relation.lib.php');
00048 $cfgRelation = PMA_getRelationsParam();
00049
00050 function PMA_multimerge(&$stack, &$table) {
00051 global $list_item, $table_item;
00052
00053 $key = array_shift($table);
00054
00055 if (count($table) > 0) {
00056 if (!isset($stack[$key])) {
00057 $stack[$key] = '';
00058 }
00059 PMA_multimerge($stack[$key], $table);
00060 } else {
00061 $stack['pma_name'][] = $table_item;
00062 $stack['pma_list_item'][] = $list_item;
00063 }
00064 }
00065
00066
00067
00068 function PMA_reduceNest(&$_table) {
00069 if ($GLOBALS['cfg']['LeftFrameTableLevel'] > 0) {
00070 $elements = count($_table);
00071 for ($ti = $elements; $ti > $GLOBALS['cfg']['LeftFrameTableLevel']; $ti--) {
00072 unset($_table[$ti]);
00073 }
00074 }
00075 }
00076
00077 function PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val, $childout = true) {
00078 $name = $key;
00079
00080 $id = base64_encode($baseid . $keyhistory . $key) . $indent;
00081
00082 $groupkey = $keyhistory . ($key != $keyhistory ? $GLOBALS['cfg']['LeftFrameTableSeparator'] . $key : '');
00083
00084 $on_mouse = (($GLOBALS['cfg']['LeftPointerEnable'] == FALSE) ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $id . '\', \'' . $GLOBALS['cfg']['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $id . '\', \'' . $GLOBALS['cfg']['LeftBgColor'] . '\')}"');
00085
00086 $countarray = $val;
00087 if (count($countarray) == 2 && isset($countarray['pma_name']) && isset($countarray['pma_list_item'])) {
00088 $counter = count($countarray['pma_name']);
00089 } else {
00090 unset($countarray['pma_name']);
00091 if (count($countarray) > 1) {
00092 unset($countarray['pma_list_item']);
00093 }
00094 $counter = count($countarray);
00095 }
00096
00097 echo "\n";
00098 echo str_repeat(' ', $indent * 5) . '<div id="el' . $id . 'Parent" class="parent"' . $on_mouse . '>' . "\n";
00099 echo str_repeat(' ', $indent * 6) . '<div class="nowrap"><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" border="0" width="' . (($indent - 1) * $indent_level) . '" height="9" alt="" /><a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '&tbl_group=' . htmlspecialchars($groupkey) . '" onclick="if (capable) {expandBase(\'el' . $id . '\', true); return false} else {return true}">';
00100 echo '<img name="imEx" id="el' . $id . 'Img" src="' . $GLOBALS['pmaThemeImage'] . 'b_plus.png" border="0" width="9" height="9" alt="+" /></a>' . "\n";
00101 echo str_repeat(' ', $indent * 6) . '<a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '&tbl_group=' . htmlspecialchars($groupkey) . '" 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></div>' . "\n";
00102 echo str_repeat(' ', $indent * 5) . '</div><!-- class="PMA_nestedSetHeaderParent" -->' . "\n";
00103 echo "\n";
00104
00105 if ($childout) {
00106 echo str_repeat(' ', $indent * 5) . '<div id="el' . $id . 'Child" class="child nowrap" ' . $on_mouse . '>' . "\n";
00107 }
00108 }
00109
00110 function PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent_level, $headerOut, $firstGroup = false, $firstGroupClose = true) {
00111 if ($firstGroup) {
00112 PMA_nestedSetHeaderParent($baseid, $firstGroup, $keyhistory, $indent, $indent_level, $tablestack);
00113 $indent++;
00114 }
00115
00116 foreach ($tablestack AS $key => $val) {
00117 if ($key != 'pma_name' && $key != 'pma_list_item') {
00118 if ($headerOut) {
00119 PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val);
00120 }
00121
00122 if (isset($val['pma_name']) && isset($val['pma_list_item']) && count($val) == 2) {
00123 PMA_nestedSet($baseid, $val, $key, $keyhistory . ($keyhistory != '' ? $GLOBALS['cfg']['LeftFrameTableSeparator'] : '') . $key, false, ($indent + 1));
00124 } else {
00125 PMA_nestedSet($baseid, $val, $key, $keyhistory . ($keyhistory != '' ? $GLOBALS['cfg']['LeftFrameTableSeparator'] : '') . $key, true, ($indent + 1));
00126 }
00127
00128 if ($headerOut) {
00129 echo str_repeat(' ', $indent * 5) . '</div><!-- class="PMA_nestedSetHeader" -->' . "\n";
00130 }
00131 }
00132 }
00133
00134 if ($firstGroup && $firstGroupClose) {
00135 echo str_repeat(' ', $indent * 4) . '</div><!-- class="PMA_nestedSetHeader2" -->' . "\n";
00136 } elseif ($firstGroup) {
00137 echo str_repeat(' ', $indent * 4) . '<!-- spacer="div omitted" class="PMA_nestedSetHeader2" -->' . "\n";
00138 }
00139 }
00140
00141 function PMA_nestedSet($baseid, $tablestack, $key = '__protected__', $keyhistory = '', $headerOut = false, $indent = 1) {
00142
00143 if ($keyhistory == '' && $key != '__protected__') {
00144 $keyhistory = $key;
00145 }
00146
00147 $indent_level = 9;
00148
00149 if (isset($tablestack)
00150 && isset($tablestack['pma_name'])
00151 && isset($tablestack['pma_list_item'])) {
00152
00153 if (count($tablestack) > 1 && !empty($key) && isset($tablestack['pma_name']) && isset($tablestack['pma_list_item']) && $indent == 1) {
00154 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, ($indent+1), $indent_level, $headerOut, $key, false);
00155 $divClose = true;
00156 $extra_indent = 1;
00157 } else {
00158 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent_level, $headerOut);
00159 $divClose = false;
00160 $extra_indent = 0;
00161 }
00162
00163 $on_mouse = (($GLOBALS['cfg']['LeftPointerEnable'] == FALSE) ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $keyhistory . $key . '\', \'' . $GLOBALS['cfg']['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $keyhistory . $key . '\', \'' . $GLOBALS['cfg']['LeftBgColor'] . '\')}"');
00164
00165 $loops = 0;
00166 foreach ($tablestack['pma_name'] AS $tkey => $tval) {
00167
00168 echo str_repeat(' ', $indent * 5) . '<img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' .'" border="0" width="' . (($indent+$extra_indent) * $indent_level) . '" height="9" alt="" />';
00169 $items = explode("\n", $tablestack['pma_list_item'][$tkey]);
00170 foreach ($items AS $ikey => $ival) {
00171 echo "\n";
00172 echo str_repeat(' ', ($indent * 5)) . $ival;
00173 }
00174 echo "\n";
00175
00176 $loops++;
00177 }
00178
00179 if ($divClose) {
00180 echo str_repeat(' ', $indent * 5) . '</div><!-- space="putting omitted div" class="PMA_nestedSet2" -->';
00181 }
00182
00183 } elseif (is_array($tablestack)) {
00184 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, (($key == '__protected__' && $indent == 1 )? ($indent-1) : ($indent + 1)), $indent_level, $headerOut, (($key == '__protected__' && $indent == 1) || ($indent > 1) ? false : $key));
00185 }
00186
00187 return true;
00188 }
00194 if ($server > 0) {
00195 PMA_availableDatabases();
00196 } else {
00197 $num_dbs = 0;
00198 }
00199
00200
00201
00202
00203
00204
00205 require_once('./libraries/header_http.inc.php');
00206
00210
00211 PMA_setFontSizes();
00212 echo "<?xml version=\"1.0\" encoding=\"" . $GLOBALS['charset'] . "\"?".">";
00213 ?>
00214 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
00215 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
00216 <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; ?>">
00217
00218 <head>
00219 <title>phpMyAdmin</title>
00220 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
00221 <base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> target="phpmain<?php echo $hash; ?>" />
00222
00223 <script type="text/javascript" language="javascript">
00224 <!--
00225 function goTo(targeturl, targetframe) {
00226 if (!targetframe) {
00227 targetframe = self;
00228 }
00229
00230 if (targetframe) {
00231 <?php if (PMA_USR_BROWSER_AGENT != 'SAFARI') { ?>
00232 targetframe.location.replace(targeturl);
00233 <?php } else { ?>
00234 targetframe.location.href = targeturl;
00235 <?php } ?>
00236 }
00237
00238 return true;
00239 }
00240
00241 <?php
00242 if (isset($lightm_db) && !empty($lightm_db)) {
00243 ?>
00244 goTo('./<?php echo $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db, '', '&');?>', window.parent.frames['phpmain<?php echo $hash; ?>']);
00245 <?php
00246 } elseif (isset($lightm_db)) {
00247 ?>
00248 goTo('./main.php?<?php echo PMA_generate_common_url('', '', '&');?>', window.parent.frames['phpmain<?php echo $hash; ?>']);
00249 <?php
00250 }
00251 ?>
00252
00253 </script>
00254
00255 <?php
00256
00257
00258 if (($num_dbs > 1 || !empty($cfg['LeftFrameTableSeparator'])) && !$cfg['LeftFrameLight']) {
00259 echo "\n";
00260 ?>
00261 <!-- Collapsible tables list scripts -->
00262 <script type="text/javascript" language="javascript">
00263 <!--
00264 var imgUrlPlus = "<?php echo $GLOBALS['pmaThemeImage'] . 'b_plus.png'; ?>";
00265 var imgUrlMinus = "<?php echo $GLOBALS['pmaThemeImage'] . 'b_minus.png'; ?>";
00266 var isDOM = (typeof(document.getElementsByTagName) != 'undefined'
00267 && typeof(document.createElement) != 'undefined')
00268 ? 1 : 0;
00269 var isIE4 = (typeof(document.all) != 'undefined'
00270 && parseInt(navigator.appVersion) >= 4)
00271 ? 1 : 0;
00272 var isNS4 = (typeof(document.layers) != 'undefined')
00273 ? 1 : 0;
00274 var capable = (isDOM || isIE4 || isNS4)
00275 ? 1 : 0;
00276
00277 if (capable) {
00278 if (typeof(window.opera) != 'undefined') {
00279 var browserName = ' ' + navigator.userAgent.toLowerCase();
00280 if ((browserName.indexOf('konqueror 7') == 0)) {
00281 capable = 0;
00282 }
00283 }
00284 else if (typeof(navigator.userAgent) != 'undefined') {
00285 var browserName = ' ' + navigator.userAgent.toLowerCase();
00286 if ((browserName.indexOf('konqueror') > 0) && (browserName.indexOf('konqueror/3') == 0)) {
00287 capable = 0;
00288 }
00289 }
00290 }
00291
00292 var isServer = <?php echo ($server > 0) ? 'true' : 'false'; ?>;
00293
00294 document.writeln('<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&js_frame=left&js_capable=' + capable + '&js_isDOM=' + isDOM + '&js_isIE4=' + isIE4 + '" />');
00295
00296 </script>
00297 <noscript>
00298 <link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&js_frame=left&js_capable=0&js_isDOM=0&js_isIE4=0" />
00299 </noscript>
00300
00301 <script src="libraries/left.js" type="text/javascript" language="javascript1.2"></script>
00302 <?php
00303 }
00304
00305 else if ($num_dbs == 1) {
00306 echo "\n";
00307 ?>
00308 <link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?js_frame=left&js_capable=0&js_isDOM=0&js_isIE4=0" />
00309 <?php
00310 }
00311
00312 else {
00313 echo "\n";
00314 ?>
00315 <link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?js_frame=left&num_dbs=0" />
00316 <?php
00317 }
00318
00319 echo "\n";
00320 ?>
00321 </head>
00322
00323 <body bgcolor="<?php echo $cfg['LeftBgColor']; ?>" id="body_leftFrame">
00324
00325 <?php
00326 if ($cfg['LeftDisplayLogo'] && !$cfg['QueryFrame']) {
00327 ?>
00328 <!-- phpMyAdmin logo -->
00329 <?php
00330 if (@file_exists($pmaThemeImage . 'logo_left.png')) {
00331 ?>
00332 <div align="center">
00333 <a href="http://www.phpmyadmin.net" target="_blank"><img src="<?php echo '' . $pmaThemeImage . 'logo_left.png'; ?>" alt="phpMyAdmin" vspace="3" border="0" /></a>
00334 </div>
00335 <?php
00336 } else {
00337 echo '<div align="center"><a href="http://www.phpmyadmin.net" target="_blank">';
00338 echo '<img src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo2.png' . '" alt="phpMyAdmin" border="0" />';
00339 echo '</a></div>' . "\n";
00340 }
00341 echo '<hr />';
00342 }
00343 echo "\n";
00344
00345 if (!$cfg['QueryFrame']) {
00346 echo "\n";
00347 ?>
00348 <!-- Link to the welcome page -->
00349 <div id="el1Parent" class="parent nowrap" align="center">
00350 <?php
00351 if ($cfg['MainPageIconic']) {
00352 $str_spacer_links='';
00353 } else{
00354 $str_spacer_links=' - ';
00355 }
00356 echo '<a class="item" href="main.php?' . PMA_generate_common_url() . '" target="phpmain' . $hash . '">'
00357 . ($cfg['MainPageIconic']
00358 ? '<img src="' . $pmaThemeImage . 'b_home.png" width="16" height="16" border="0" hspace="2" alt="' . $strHome . '" title="' . $strHome . '"'
00359 .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />'
00360 : '<b>' . $strHome . '</b>')
00361 . '</a>';
00362
00363 if ($server != 0 && $cfg['Server']['auth_type'] != 'config') {
00364 echo $str_spacer_links;
00365 echo '<a class="item" href="index.php?' . PMA_generate_common_url() . '&old_usr=' . urlencode($PHP_AUTH_USER) . '" target="_parent">'
00366 . ($cfg['MainPageIconic']
00367 ? '<img src="' . $pmaThemeImage . 's_loggoff.png" width="16" height="16" border="0" hspace="2" alt="' . $strLogout . '" title="' . $strLogout . '"'
00368 .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />'
00369 : '<b>' . $strLogout . '</b>')
00370 . '</a>';
00371 }
00372 if ($cfg['MainPageIconic']) {
00373 echo '<img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="2" height="1" border="0" />'
00374 . '<a href="Documentation.html" target="documentation" class="item">'
00375 . '<img src="' . $pmaThemeImage . 'b_docs.png" border="0" hspace="1" width="16" height="16" alt="' . $strPmaDocumentation . '" title="' . $strPmaDocumentation . '"'
00376 .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />'
00377 . '</a>';
00378 echo ''
00379 . '<a href="' . $cfg['MySQLManualBase'] . '" target="documentation" class="item">'
00380 . '<img src="' . $pmaThemeImage . 'b_sqlhelp.png" border="0" hspace="1" width="16" height="16" alt="MySQL - ' . $strDocu . '" title="MySQL - ' . $strDocu . '"'
00381 .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />'
00382 . '</a>';
00383 }
00384 ?>
00385 </div>
00386 <hr />
00387 <?php
00388 if ($cfg['LeftDisplayServers']) {
00389 $show_server_left = TRUE;
00390 include('./libraries/select_server.lib.php');
00391 }
00392 }
00393
00394 ?>
00395 <!-- Databases and tables list -->
00396 <div id="left_tableList">
00397 <?php
00398
00399
00400
00401
00402
00403
00404
00405
00406 if ($num_dbs > 1) {
00407
00408
00409
00410
00411
00412 if ($cfg['LeftFrameLight']) {
00413 if (!$cfg['QueryFrame']) {
00414 ?>
00415 <script type="text/javascript" language="javascript">
00416 <!--
00417 document.writeln('<form method="post" action="left.php" name="left" target="nav" style="margin: 0px; padding: 0px;">');
00418
00419 </script>
00420 <noscript>
00421 <form method="post" action="index.php" name="left" target="_parent" style="margin: 0px; padding: 0px;">
00422 </noscript>
00423 <?php
00424 echo PMA_generate_common_hidden_inputs();
00425 echo ' <input type="hidden" name="hash" value="' . $hash . '" />' . "\n";
00426 echo ' <span class="heada"><b>' . $strDatabase . ':</b></span><br />';
00427 echo ' <select name="lightm_db" onchange="this.form.submit()">' . "\n";
00428 echo ' <option value="">(' . $strDatabases . ') ...</option>' . "\n";
00429 }
00430
00431 $table_list = '';
00432 $table_list_header = '';
00433 $db_name = '';
00434 }
00435
00436 $selected_db = 0;
00437
00438
00439
00440
00441 if (!is_array($cfg['Server']['only_db']) && $cfg['NaturalOrder'] && $num_dbs > 0) {
00442 $dblist_temp = $dblist;
00443 natsort($dblist_temp);
00444 $i = 0;
00445 foreach ($dblist_temp as $each) {
00446 $dblist[$i] = $each;
00447 $i++;
00448 }
00449 }
00450
00451
00452 for ($i = 0; $i < $num_dbs; $i++) {
00453 $db = $dblist[$i];
00454 $j = $i + 2;
00455 if (!empty($db_start) && $db == $db_start) {
00456 $selected_db = $j;
00457 }
00466 $tables = PMA_DBI_try_query('SHOW ' . (PMA_MYSQL_INT_VERSION >= 50000 ? 'FULL ' : '') . 'TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
00467 $num_tables = ($tables) ? @PMA_DBI_num_rows($tables) : 0;
00468 $common_url_query = PMA_generate_common_url($db);
00469 if ($num_tables) {
00470 $num_tables_disp = $num_tables;
00471 } else {
00472 $num_tables_disp = '-';
00473 }
00474
00475
00476 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303
00477 && $num_tables
00478 && (!$cfg['LeftFrameLight'] || $selected_db == $j)) {
00479 $tooltip = array();
00480 $tooltip_name = array();
00481 $result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
00482 while ($tmp = PMA_DBI_fetch_assoc($result)) {
00483 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '');
00484 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] && $cfg['ShowTooltipAliasTB'] !== 'nested' ? $tmp['Name'] : $tmp['Comment']);
00485
00486 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '')
00487 . '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')';
00488 }
00489 }
00490
00491
00492 $db_tooltip = '';
00493 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
00494 $tmp_db_tooltip = PMA_getComments($db);
00495 if (is_array($tmp_db_tooltip)) {
00496 $db_tooltip = implode(' ', $tmp_db_tooltip);
00497 }
00498 }
00499
00500
00501 if ($cfg['LeftFrameLight'] == FALSE) {
00502
00503
00504 $on_mouse = (($cfg['LeftPointerEnable'] == FALSE) ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftBgColor'] . '\')}"');
00505
00506 echo "\n";
00507 echo ' <div id="el' . $j . 'Parent" class="parent nowrap"' . $on_mouse . '>';
00508
00509 if (!empty($num_tables)) {
00510 echo "\n";
00511 ?>
00512 <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}">
00513 <img name="imEx" id="el<?php echo $j; ?>Img" src="<?php echo $pmaThemeImage; ?>b_plus.png" border="0" width="9" height="9" alt="+" /></a>
00514 <?php
00515 } else {
00516 echo "\n";
00517 ?>
00518 <img name="imEx" src="<?php echo $pmaThemeImage; ?>b_minus.png" border="0" width="9" height="9" alt="-" />
00519 <?php
00520 }
00521 echo "\n";
00522 ?>
00523 <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)}">
00524 <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>
00525 </div>
00526
00527 <div id="el<?php echo $j;?>Child" class="child nowrap" style="margin-bottom: 5px"<?php echo $on_mouse; ?>>
00528 <?php
00529
00530 $tablestack = array();
00531 $table_array = array();
00532 $table_types = array();
00533 while (@list($table, $type) = PMA_DBI_fetch_row($tables)) {
00534 $table_item = (!empty($tooltip_name) && isset($tooltip_name[$table]) && !empty($tooltip_name[$table]) && $cfg['ShowTooltipAliasTB'] && strtolower($cfg['ShowTooltipAliasTB']) !== 'nested'
00535 ? htmlspecialchars($tooltip_name[$table])
00536 : htmlspecialchars($table));
00537 $table_array[$table] = $table_item;
00538 $table_types[$table] = empty($type) ? 'BASE TABLE' : $type;
00539 }
00540
00541 if ($cfg['NaturalOrder']) {
00542 natsort($table_array);
00543 }
00544
00545 $book_sql_cache = PMA_queryDBBookmarks($db, $cfg['Bookmark'], $table_array);
00546 foreach ($table_array as $table => $table_sortkey) {
00547 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
00548 ? htmlspecialchars($tooltip_name[$table])
00549 : '';
00550 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
00551 ? htmlspecialchars($tooltip[$table])
00552 : '';
00553 $table_item = ($alias != '' && $cfg['ShowTooltipAliasTB'] && strtolower($cfg['ShowTooltipAliasTB']) !== 'nested'
00554 ? $alias
00555 : htmlspecialchars($table));
00556 $tablename = ($alias != '' && $cfg['ShowTooltipAliasTB']
00557 ? $alias
00558 : htmlspecialchars($table));
00559
00560 $book_sql_query = (isset($book_sql_cache[$table]) ? $book_sql_cache[$table] : FALSE);
00561
00562 $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 . '">';
00563 $list_item .= '<img src="' . $pmaThemeImage . ($table_types[$table] == 'VIEW' ? 's_views' : 'b_sbrowse') . '.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" /></a>';
00564 $list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n";
00565 $list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">';
00566 $list_item .= $table_item . '</a><br />' . "\n";
00567
00568
00569 if (!empty($cfg['LeftFrameTableSeparator'])) {
00570 $_table = explode($cfg['LeftFrameTableSeparator'], str_replace('\'', '\\\'', $tablename));
00571 if (is_array($_table)) {
00572 foreach ($_table AS $key => $val) {
00573 if ($val == '') {
00574 $_table[$key] = '__protected__';
00575 }
00576 }
00577 PMA_reduceNest($_table);
00578
00579 if (count($_table) == 1) {
00580 array_unshift($_table, '');
00581 }
00582 PMA_multimerge($tablestack, $_table);
00583 } else {
00584 $tablestack['']['pma_name'][] = $table_item;
00585 $tablestack['']['pma_list_item'][] = $list_item;
00586 }
00587 } else {
00588 $tablestack['']['pma_name'][] = $table_item;
00589 $tablestack['']['pma_list_item'][] = $list_item;
00590 }
00591 }
00592
00593 PMA_nestedSet($j, $tablestack);
00594 ?>
00595 </div>
00596 <?php
00597 echo "\n";
00598 }
00599
00600
00601
00602 else {
00603 echo "\n";
00604
00605
00606 if (!empty($db_start) && $db == $db_start) {
00607 $table_title = array();
00608 $table_array = array();
00609
00610 $book_sql_cache = PMA_queryDBBookmarks($db, $cfg['Bookmark'], $table_array);
00611 while (@list($table, $type) = PMA_DBI_fetch_row($tables)) {
00612 $table_array[$table] = '';
00613 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
00614 ? htmlspecialchars($tooltip[$table])
00615 : '';
00616 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
00617 ? htmlspecialchars($tooltip_name[$table])
00618 : '';
00619
00620 $book_sql_query = (isset($book_sql_cache[$table]) ? $book_sql_cache[$table] : FALSE);
00621
00622
00623
00624 $table_array[$table] .= ' <div class="nowrap"><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";
00625 $table_array[$table] .= ' <img src="' . $pmaThemeImage . (!empty($type) && $type == 'VIEW' ? 's_views' : 'b_sbrowse') . '.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" title="' . $strBrowse . ': ' . $url_title . '" /></a><bdo dir="' . $text_dir . '"> </bdo>' . "\n";
00626
00627 if (PMA_USR_BROWSER_AGENT == 'IE') {
00628 $table_array[$table] .= ' <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></div>' . "\n";
00629 } else {
00630 $table_array[$table] .= ' <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></div>' . "\n";
00631 }
00632
00633 $table_title[$table] = htmlspecialchars($table);
00634
00635 }
00636
00637 if (count($table_title) > 0) {
00638 if ($cfg['NaturalOrder'] && $num_tables > 0) {
00639 natsort($table_title);
00640 }
00641
00642 foreach ($table_title as $each_key => $each_val) {
00643 $table_list .= ' ' . $table_array[$each_key];
00644 }
00645 } else {
00646 $table_list = ' <br /><br />' . "\n"
00647 . ' <div>' . $strNoTablesFound . '</div>' . "\n";
00648 }
00649 $selected = ' selected="selected"';
00650
00651 $table_list_header .= ' <a class="item" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabDatabase'] . '?' . $common_url_query . '">' . "\n";
00652 $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";
00653 } else {
00654 $selected = '';
00655 }
00656 if (!$cfg['QueryFrame']) {
00657 if (!empty($num_tables)) {
00658 echo ' <option value="' . htmlspecialchars($db) . '"' . $selected . '>'
00659 . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (' . $num_tables . ')</option>' . "\n";
00660 } else {
00661 echo ' <option value="' . htmlspecialchars($db) . '"' . $selected . '>'
00662 . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (-)</option>' . "\n";
00663 }
00664 }
00665
00666 }
00667
00668 }
00669
00670
00671
00672 if ($cfg['LeftFrameLight']) {
00673 if (!$cfg['QueryFrame']) {
00674 echo ' </select>' . "\n";
00675 echo ' <noscript><input type="submit" name="Go" value="' . $strGo . '" /></noscript>' . "\n";
00676 echo ' </form>' . "\n";
00677 }
00678 if (!$table_list) {
00679 $table_list = ' <div align="center"><b>' . $strSelectADb . '</b></div>' . "\n";
00680 }
00681
00682
00683
00684 if (!$cfg['QueryFrame']) {
00685 echo '<hr />';
00686 }
00687 echo $table_list_header;
00688 echo $table_list;
00689 }
00690
00691
00692
00693 else {
00694 ?>
00695
00696 <!-- Arrange collapsible/expandable db list at startup -->
00697 <script type="text/javascript" language="javascript1.2">
00698 <!--
00699 if (isNS4) {
00700 firstEl = 'el1Parent';
00701 firstInd = nsGetIndex(firstEl);
00702 nsShowAll();
00703 nsArrangeList();
00704 }
00705 var expandedDb = '<?php echo (empty($selected_db)) ? '' : 'el' . $selected_db . 'Child'; ?>';
00706
00707 </script>
00708 <?php
00709
00710 }
00711
00712 }
00713
00714
00715
00716 else if ($num_dbs == 1) {
00717 $db = $dblist[0];
00718 $tables = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
00719 $num_tables = ($tables) ? @PMA_DBI_num_rows($tables) : 0;
00720 $common_url_query = PMA_generate_common_url($db);
00721 if ($num_tables) {
00722 $num_tables_disp = $num_tables;
00723 } else {
00724 $num_tables_disp = '-';
00725 }
00726
00727
00728 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303
00729 && $num_tables) {
00730 $tooltip = array();
00731 $tooltip_name = array();
00732 $result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db), NULL, PMA_DBI_QUERY_STORE);
00733 while ($tmp = PMA_DBI_fetch_assoc($result)) {
00734 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '');
00735 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] && $cfg['ShowTooltipAliasTB'] !== 'nested' ? $tmp['Name'] : $tmp['Comment']);
00736
00737 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '')
00738 . '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')';
00739 }
00740 }
00741
00742
00743 $db_tooltip = '';
00744 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
00745 $tmp_db_tooltip = PMA_getComments($db);
00746 if (is_array($tmp_db_tooltip)) {
00747 $db_tooltip = implode(' ', $tmp_db_tooltip);
00748 }
00749 }
00750
00751
00752
00753 if (!$cfg['LeftFrameLight']) {
00754 $on_mouse = (($cfg['LeftPointerEnable'] == FALSE) ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el2\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el2\', \'' . $cfg['LeftBgColor'] . '\')}"');
00755
00756 echo "\n";
00757 echo ' <div id="el2Parent" class="parent"' . $on_mouse . '>';
00758
00759 if (!empty($num_tables)) {
00760 echo "\n";
00761 ?>
00762 <div class="nowrap"><a class="item" href="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>" onclick="if (capable) {expandBase('el2', true); return false} else {return true}">
00763 <img name="imEx" id="el2Img" src="<?php echo $pmaThemeImage; ?>b_plus.png" border="0" width="9" height="9" alt="+" /></a>
00764 <?php
00765 } else {
00766 echo "\n";
00767 ?>
00768 <div class="nowrap"><img name="imEx" src="<?php echo $pmaThemeImage; ?>b_minus.png" border="0" width="9" height="9" alt="-" />
00769 <?php
00770 }
00771 echo "\n";
00772 ?>
00773 <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)}">
00774 <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></div>
00775 </div>
00776
00777 <div id="el2Child" class="child" style="margin-bottom: 5px"<?php echo $on_mouse; ?>>
00778 <?php
00779 } else {
00780 echo "\n";
00781 ?>
00782 <div id="el2Parent" class="parent nowrap">
00783 <a class="item" href="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>">
00784 <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>
00785 </div>
00786 <div id="el2Child" class="child nowrap" style="margin-bottom: 5px">
00787 <?php
00788 }
00789
00790
00791 $tablestack = array();
00792 $table_array = array();
00793 while (list($table) = PMA_DBI_fetch_row($tables)) {
00794 $table_item = (!empty($tooltip_name) && isset($tooltip_name[$table]) && !empty($tooltip_name[$table]) && $cfg['ShowTooltipAliasTB'] && strtolower($cfg['ShowTooltipAliasTB']) !== 'nested'
00795 ? htmlspecialchars($tooltip_name[$table])
00796 : htmlspecialchars($table));
00797 $table_array[$table] = $table_item;
00798 }
00799
00800 if ($cfg['NaturalOrder']) {
00801 natcasesort($table_array);
00802 }
00803
00804 $book_sql_cache = PMA_queryDBBookmarks($db, $cfg['Bookmark'], $table_array);
00805 foreach ($table_array as $table => $table_sortkey) {
00806 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
00807 ? htmlspecialchars($tooltip_name[$table])
00808 : '';
00809 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
00810 ? htmlspecialchars($tooltip[$table])
00811 : '';
00812 $table_item = ($alias != '' && $cfg['ShowTooltipAliasTB'] && strtolower($cfg['ShowTooltipAliasTB']) !== 'nested'
00813 ? $alias
00814 : htmlspecialchars($table));
00815 $tablename = ($alias != '' && $cfg['ShowTooltipAliasTB']
00816 ? $alias
00817 : htmlspecialchars($table));
00818
00819 $book_sql_query = (isset($book_sql_cache[$table]) ? $book_sql_cache[$table] : FALSE);
00820
00821 if ($cfg['LeftFrameLight']) {
00822 echo "\n";
00823 ?>
00824 <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; ?>">
00825 <img src="<?php echo $pmaThemeImage . 'b_sbrowse.png'; ?>" width="10" height="10" border="0" alt="<?php echo $strBrowse . ': ' . $url_title; ?>" /></a><bdo dir="<?php echo $text_dir; ?>"> </bdo>
00826 <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); ?>">
00827 <?php echo $table_item; ?></a><br />
00828 <?php
00829 } else {
00830 $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 . '">';
00831 $list_item .= '<img src="' . $pmaThemeImage . 'b_sbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" /></a>';
00832 $list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n";
00833 $list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">';
00834 $list_item .= $table_item . '</a><br />';
00835
00836
00837 if (!empty($cfg['LeftFrameTableSeparator'])) {
00838 $_table = explode($cfg['LeftFrameTableSeparator'], str_replace('\'', '\\\'', $tablename));
00839 if (is_array($_table)) {
00840 foreach ($_table AS $key => $val) {
00841 if ($val == '') {
00842 $_table[$key] = '__protected__';
00843 }
00844 }
00845 PMA_reduceNest($_table);
00846
00847 if (count($_table) == 1) {
00848 array_unshift($_table, '');
00849 }
00850 PMA_multimerge($tablestack, $_table);
00851 } else {
00852 $tablestack['']['pma_name'][] = $table_item;
00853 $tablestack['']['pma_list_item'][] = $list_item;
00854 }
00855 } else {
00856 $tablestack['']['pma_name'][] = $table_item;
00857 $tablestack['']['pma_list_item'][] = $list_item;
00858 }
00859 }
00860 }
00861
00862 if (!$cfg['LeftFrameLight']) {
00863 PMA_nestedSet('1', $tablestack);
00864 ?>
00865 </div>
00866 <!-- Arrange collapsible/expandable db list at startup -->
00867 <script type="text/javascript" language="javascript1.2">
00868 <!--
00869 if (isNS4) {
00870 firstEl = 'el1Parent';
00871 firstInd = nsGetIndex(firstEl);
00872 nsShowAll();
00873 nsArrangeList();
00874 }
00875 var expandedDb = '<?php echo (empty($selected_db)) ? '' : 'el' . $selected_db . 'Child'; ?>';
00876
00877 </script>
00878 <?php
00879 } else {
00880 echo ' </div>';
00881 }
00882
00883 echo "\n";
00884 }
00885
00886
00887
00888 else {
00889 echo "\n";
00890 echo '<p>' . $strNoDatabases . '</p>';
00891 }
00892 echo "\n";
00893
00894
00895
00896
00897 $my_lightm_db = '';
00898 if (isset($lightm_db) && $lightm_db!='') {
00899 $my_lightm_db = $lightm_db;
00900 }
00901
00902 if ($cfg['LeftFrameLight'] && $cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
00903 if (!isset($table_array) || count($table_array)==0) {
00904 $my_url_query = PMA_generate_common_url('', '', '&');
00905 ?>
00906 <script language="JavaScript" type="text/javascript">
00907 <!--
00908 function check_queryframe_reload() {
00909 if (typeof(window.parent.frames['queryframe'])!='undefined' && typeof(window.parent.frames['queryframe'].document.forms['left'])!='undefined') {
00910 if (window.parent.frames['queryframe'].document.forms['left'].elements['lightm_db'].value!='<?php echo $my_lightm_db; ?>') {
00911 window.parent.frames['queryframe'].location.replace('<?php echo 'queryframe.php?' . $my_url_query . '&hash=' . $hash; ?>');
00912 }
00913 }
00914 }
00915
00916
00917
00918
00919 setTimeout('check_queryframe_reload()', 1000);
00920
00921
00922 </script>
00923 <?php
00924 }
00925 }
00926 ?>
00927 </div>
00928 </body>
00929 </html>
00930
00931 <?php
00935 if (isset($dbh) && $dbh) {
00936 @PMA_DBI_close($dbh);
00937 }
00938 if (isset($userlink) && $userlink) {
00939 @PMA_DBI_close($userlink);
00940 }
00941
00942
00946 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
00947 && isset($ob_mode) && $ob_mode) {
00948 PMA_outBufferPost($ob_mode);
00949 }
00950 ?>