bug #1971221 [interface] tabindex not set correctly
[phpmyadmin/crack.git] / navigation.php
blobba2cd4502ac268e2ba934d7b95a109bed24151f1
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * the navigation frame - displays server, db and table selection tree
6 * @version $Id$
7 * @uses $GLOBALS['pma']->databases
8 * @uses $GLOBALS['server']
9 * @uses $GLOBALS['db']
10 * @uses $GLOBALS['table']
11 * @uses $GLOBALS['available_languages']
12 * @uses $GLOBALS['lang']
13 * @uses $GLOBALS['text_dir']
14 * @uses $GLOBALS['charset']
15 * @uses $GLOBALS['pmaThemeImage']
16 * @uses $GLOBALS['strNoDatabases']
17 * @uses $GLOBALS['strDatabase']
18 * @uses $GLOBALS['strGo']
19 * @uses $GLOBALS['strSelectADb']
20 * @uses $GLOBALS['strNoTablesFound']
21 * @uses $GLOBALS['cfg']['LeftFrameLight']
22 * @uses $GLOBALS['cfg']['ShowTooltip']
23 * @uses $GLOBALS['cfg']['ShowTooltipAliasDB']
24 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
25 * @uses $GLOBALS['cfgRelation']['commwork']) {
26 * @uses PMA_List_Database::getSingleItem()
27 * @uses PMA_List_Database::getHtmlSelectGrouped()
28 * @uses PMA_List_Database::getGroupedDetails()
29 * @uses PMA_generate_common_url()
30 * @uses PMA_generate_common_hidden_inputs()
31 * @uses PMA_getDbComment();
32 * @uses PMA_getTableCount()
33 * @uses PMA_getTableList()
34 * @uses PMA_getRelationsParam()
35 * @uses PMA_outBufferPre()
36 * @uses session_write_close()
37 * @uses strlen()
38 * @uses session_write_close()
39 * @uses is_array()
40 * @uses implode()
41 * @uses htmlspecialchars()
44 /**
45 * Gets a core script and starts output buffering work
47 require_once './libraries/common.inc.php';
49 /**
50 * finish and cleanup navigation.php script execution
52 * @uses $GLOBALS['controllink'] to close it
53 * @uses $GLOBALS['userlink'] to close it
54 * @access private only to be used in navigation.php
56 function PMA_exitNavigationFrame()
58 echo '</body></html>';
59 exit;
62 // keep the offset of the db list in session before closing it
63 if (! isset($_SESSION['userconf']['navi_limit_offset'])) {
64 $_SESSION['userconf']['navi_limit_offset'] = 0;
66 if (! isset($_SESSION['userconf']['table_limit_offset'])) {
67 $_SESSION['userconf']['table_limit_offset'] = 0;
69 if (isset($_REQUEST['pos'])) {
70 if (isset($_REQUEST['tpos'])) {
71 $_SESSION['userconf']['table_limit_offset'] = (int) $_REQUEST['pos'];
73 else {
74 $_SESSION['userconf']['navi_limit_offset'] = (int) $_REQUEST['pos'];
77 $pos = $_SESSION['userconf']['navi_limit_offset'];
78 $tpos = $_SESSION['userconf']['table_limit_offset'];
79 // free the session file, for the other frames to be loaded
80 // but only if debugging is not enabled
81 if (empty($_SESSION['debug'])) {
82 session_write_close();
85 /**
86 * the output compression library
88 require_once './libraries/ob.lib.php';
90 PMA_outBufferPre();
93 * selects the database if there is only one on current server
95 if ($GLOBALS['server'] && ! strlen($GLOBALS['db'])) {
96 $GLOBALS['db'] = $GLOBALS['pma']->databases->getSingleItem();
99 $db_start = $GLOBALS['db'];
102 * the relation library
104 require_once './libraries/relation.lib.php';
105 $cfgRelation = PMA_getRelationsParam();
108 * garvin: For re-usability, moved http-headers to a seperate file.
109 * It can now be included by libraries/header.inc.php, querywindow.php.
111 require_once './libraries/header_http.inc.php';
113 if (! isset($_SESSION['userconf']['navi_limit_offset'])) {
114 $_SESSION['userconf']['navi_limit_offset'] = 0;
116 if (! isset($_SESSION['userconf']['table_limit_offset'])) {
117 $_SESSION['userconf']['table_limit_offset'] = 0;
119 if (isset($_REQUEST['pos'])) {
120 if (isset($_REQUEST['tpos'])) {
121 $_SESSION['userconf']['table_limit_offset'] = (int) $_REQUEST['pos'];
123 else {
124 $_SESSION['userconf']['navi_limit_offset'] = (int) $_REQUEST['pos'];
127 $pos = $_SESSION['userconf']['navi_limit_offset'];
128 $tpos = $_SESSION['userconf']['table_limit_offset'];
131 * Displays the frame
133 // xml declaration moves IE into quirks mode, making much trouble with CSS
134 /* echo '<?xml version="1.0" encoding="' . $GLOBALS['charset'] . '"?>'; */
136 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
137 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
138 <html xmlns="http://www.w3.org/1999/xhtml"
139 xml:lang="<?php echo $available_languages[$lang][2]; ?>"
140 lang="<?php echo $available_languages[$lang][2]; ?>"
141 dir="<?php echo $GLOBALS['text_dir']; ?>">
143 <head>
144 <link rel="icon" href="./favicon.ico" type="image/x-icon" />
145 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
146 <title>phpMyAdmin</title>
147 <meta http-equiv="Content-Type"
148 content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
149 <base target="frame_content" />
150 <link rel="stylesheet" type="text/css"
151 href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=left&amp;nocache=<?php echo $_SESSION['PMA_Config']->getThemeUniqueValue(); ?>" />
152 <script type="text/javascript" src="js/navigation.js"></script>
153 <script type="text/javascript" src="js/functions.js"></script>
154 <script type="text/javascript">
155 // <![CDATA[
156 var image_minus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_minus.png';
157 var image_plus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_plus.png';
159 // INIT PMA_setFrameSize
160 var onloadCnt = 0;
161 var onLoadHandler = window.onload;
162 var resizeHandler = window.onresize;
163 window.document.onresize = resizeHandler;
164 window.onload = function() {
165 if (onloadCnt == 0) {
166 if (typeof(onLoadHandler) == "function") {
167 onLoadHandler();
169 if (typeof(PMA_setFrameSize) != 'undefined' && typeof(PMA_setFrameSize) == 'function') {
170 PMA_setFrameSize();
172 onloadCnt++;
175 window.onresize = function() {
176 if (typeof(resizeHandler) == "function") {
177 resizeHandler();
179 if (typeof(PMA_saveFrameSize) != 'undefined' && typeof(PMA_saveFrameSize) == 'function') {
180 PMA_saveFrameSize();
183 // ]]>
184 </script>
185 <?php
187 * remove horizontal scroll bar bug in IE 6 by forcing a vertical scroll bar
190 <!--[if IE 6]>
191 <style type="text/css">
192 /* <![CDATA[ */
193 html {
194 overflow-y: scroll;
196 /* ]]> */
197 </style>
198 <![endif]-->
199 </head>
201 <body id="body_leftFrame">
202 <?php
203 require './libraries/navigation_header.inc.php';
204 if (! $GLOBALS['server']) {
205 // no server selected
206 PMA_exitNavigationFrame();
207 } elseif (! count($GLOBALS['pma']->databases)) {
208 // no database available, so we break here
209 echo '<p>' . $GLOBALS['strNoDatabases'] . '</p>';
210 PMA_exitNavigationFrame();
211 } elseif ($GLOBALS['cfg']['LeftFrameLight'] && count($GLOBALS['pma']->databases) > 1) {
212 $list = $cfg['DisplayDatabasesList'];
213 if ($list === 'auto') {
214 if (empty($GLOBALS['db'])) {
215 $list = true;
216 } else {
217 $list = false;
220 if (!$list) {
221 // more than one database available and LeftFrameLight is true
222 // display db selectbox
224 // Light mode -> beginning of the select combo for databases
225 // Note: When javascript is active, the frameset will be changed from
226 // within navigation.php. With no JS (<noscript>) the whole frameset will
227 // be rebuilt with the new target frame.
230 <div id="databaseList">
231 <form method="post" action="index.php" target="_parent" id="left">
232 <label for="lightm_db"><?php echo $GLOBALS['strDatabase']; ?></label>
233 <?php
234 echo PMA_generate_common_hidden_inputs() . "\n";
235 echo $GLOBALS['pma']->databases->getHtmlSelectGrouped(true, $_SESSION['userconf']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
236 echo '<noscript>' . "\n"
237 .'<input type="submit" name="Go" value="' . $GLOBALS['strGo'] . '" />' . "\n"
238 .'</noscript>' . "\n"
239 .'</form>' . "\n";
240 } else {
241 if (! empty($db)) {
242 echo '<div id="databaseList">' . "\n";
244 echo $GLOBALS['pma']->databases->getHtmlListGrouped(true, $_SESSION['userconf']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
246 $_url_params = array('pos' => $pos);
247 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
248 if (! empty($db)) {
249 echo '</div>' . "\n";
254 <div id="left_tableList">
255 <?php
256 // Don't display expansible/collapsible database info if:
257 // 1. $GLOBALS['server'] == 0 (no server selected)
258 // This is the case when there are multiple servers and
259 // '$GLOBALS['cfg']['ServerDefault'] = 0' is set. In that case, we want the welcome
260 // screen to appear with no database info displayed.
261 // 2. there is only one database available (ie either only one database exists
262 // or $GLOBALS['cfg']['Servers']['only_db'] is defined and is not an array)
263 // In this case, the database should not be collapsible/expandable
265 $img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"'
266 .' width="9" height="9" alt="+" />';
267 $img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"'
268 .' width="9" height="9" alt="-" />';
270 $href_left = '<a onclick="if (toggle(\'%d\')) return false;"'
271 .' href="navigation.php?%s" target="_self">';
273 $element_counter = 0;
276 if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
277 $table_list = PMA_getTableList($GLOBALS['db']);
278 $table_count = count($table_list);
280 // show selected databasename as link to DefaultTabDatabase-page
281 // with table count in ()
282 $common_url_query = PMA_generate_common_url($GLOBALS['db']);
284 $db_tooltip = '';
286 if ($GLOBALS['cfg']['ShowTooltip']
287 && $GLOBALS['cfgRelation']['commwork']) {
288 $_db_tooltip = PMA_getDbComment($GLOBALS['db']);
289 if ($_db_tooltip) {
290 $db_tooltip = $_db_tooltip;
294 $disp_name = $GLOBALS['db'];
295 if ($db_tooltip && $GLOBALS['cfg']['ShowTooltipAliasDB']) {
296 $disp_name = $db_tooltip;
297 $disp_name_cut = $db_tooltip;
298 $db_tooltip = $GLOBALS['db'];
302 <p><a class="item"
303 href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query; ?>"
304 title="<?php echo htmlspecialchars($db_tooltip); ?>" >
305 <?php
306 if ($GLOBALS['text_dir'] === 'rtl') {
307 echo ' <bdo dir="ltr">(' . $table_count . ')</bdo> ';
309 echo '<span class="navi_dbName">' . htmlspecialchars($disp_name) . '</span>';
310 if ($GLOBALS['text_dir'] === 'ltr') {
311 echo ' <bdo dir="ltr">(' . $table_count . ')</bdo> ';
313 echo '</a></p>';
316 * This helps reducing the navi panel size; in the right panel,
317 * user can find a navigator to page thru all tables.
320 $table_list = array_slice($table_list, $tpos, $cfg['MaxTableList']);
321 if (! empty($table_list)) {
322 // upper table list paginator
323 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
324 $_url_params = array(
325 'tpos' => 'true',
326 'pos' => $tpos,
327 'db' => $GLOBALS['db']
329 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
331 PMA_displayTableList($table_list, true, '', $GLOBALS['db']);
332 // lower table list paginator
333 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
334 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
336 } else {
337 echo $GLOBALS['strNoTablesFound'];
339 unset($table_list);
340 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
341 echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
342 } else {
343 echo '<div id="databaseList">' . "\n";
344 $_url_params = array('pos' => $pos);
345 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
346 echo '</div>' . "\n";
348 $common_url_query = PMA_generate_common_url();
349 PMA_displayDbList($GLOBALS['pma']->databases->getGroupedDetails($_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']), $_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']);
353 * displays collapsable db list
355 * @uses $_REQUEST['dbgroup']
356 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
357 * @uses $GLOBALS['strSelectADb']
358 * @uses strpos()
359 * @uses urlencode()
360 * @uses printf()
361 * @uses htmlspecialchars()
362 * @uses PMA_generate_common_url()
363 * @uses PMA_getTableList()
364 * @uses PMA_displayTableList()
365 * @global $element_counter
366 * @global $img_minus
367 * @global $img_plus
368 * @global $href_left
369 * @global $db_start
370 * @global $common_url_query
371 * @param array $ext_dblist extended db list
372 * @param integer $offset
373 * @param integer $count
375 function PMA_displayDbList($ext_dblist, $offset, $count) {
376 global $element_counter, $img_minus, $img_plus, $href_left,
377 $db_start, $common_url_query;
379 // get table list, for all databases
380 // doing this in one step takes advantage of a single query with information_schema!
381 $tables_full = PMA_DBI_get_tables_full($GLOBALS['pma']->databases->getLimitedItems($offset, $count));
383 $url_dbgroup = '';
384 echo '<ul id="leftdatabaselist">';
385 $close_db_group = false;
386 foreach ($ext_dblist as $group => $db_group) {
387 if (count($GLOBALS['pma']->databases) > 1) {
388 if ($close_db_group) {
389 $url_dbgroup = '';
390 echo '</ul>';
391 echo '</li>';
392 $close_db_group = false;
394 if (count($db_group) > 1) {
395 $close_db_group = true;
396 $url_dbgroup = '&amp;dbgroup=' . urlencode($group);
397 $common_url_query = PMA_generate_common_url() . $url_dbgroup;
398 $element_counter++;
399 echo '<li class="dbgroup">';
400 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
401 || $db_start == $group || strpos($db_start, $group) === 0) {
402 // display + only if this db(group) is not preselected
403 printf($href_left, $element_counter, PMA_generate_common_url());
404 printf($img_minus, $element_counter);
405 } else {
406 printf($href_left, $element_counter, $common_url_query);
407 printf($img_plus, $element_counter);
409 echo '</a> ' . $group . "\n";
410 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
411 || $db_start == $group || strpos($db_start, $group) === 0) {
412 echo '<ul id="subel' . $element_counter . '">' . "\n";
413 } else {
414 echo '<ul id="subel' . $element_counter . '"'
415 .' style="display: none">' . "\n";
419 foreach ($db_group as $db) {
420 $common_url_query = PMA_generate_common_url($db['name']) . $url_dbgroup;
422 $element_counter++;
423 // Displays the database name
424 echo '<li>' . "\n";
426 if (count($GLOBALS['pma']->databases) > 1) {
427 // only with more than one db we need collapse ...
428 if ($db_start != $db['name'] || $db['num_tables'] < 1) {
429 // display + only if this db is not preselected
430 // or table count is 0
431 printf($href_left, $element_counter, $common_url_query);
432 printf($img_plus, $element_counter);
433 } else {
434 printf($href_left, $element_counter,
435 PMA_generate_common_url() . $url_dbgroup);
436 printf($img_minus, $element_counter);
438 echo '</a>';
440 // ... and we need to refresh both frames on db selection
442 <a class="item"
443 id="<?php echo htmlspecialchars($db['name']); ?>"
444 href="index.php?<?php echo $common_url_query; ?>"
445 target="_parent"
446 title="<?php echo htmlspecialchars($db['comment']); ?>"
447 onclick="
448 if (! toggle('<?php echo $element_counter; ?>', true))
449 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
450 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
451 . '?' . $common_url_query; ?>', 'main');
452 return false;">
453 <?php
454 if ($GLOBALS['text_dir'] === 'rtl') {
455 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
457 echo htmlspecialchars($db['disp_name']);
458 if ($GLOBALS['text_dir'] === 'ltr') {
459 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
462 </a>
463 <?php
464 } else {
465 // with only 1 db available we dont need to refresh left frame
466 // on db selection, only phpmain
468 <a href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
469 . '?' . $common_url_query; ?>"
470 id="<?php echo htmlspecialchars($db['name']); ?>"
471 title="<?php echo htmlspecialchars($db['comment']); ?>">
472 <?php
473 if ($GLOBALS['text_dir'] === 'rtl') {
474 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
476 echo htmlspecialchars($db['disp_name']);
477 if ($GLOBALS['text_dir'] === 'ltr') {
478 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
481 </a>
482 <?php
484 if ($db['num_tables']) {
485 if (isset($tables_full[$db['name']])) {
486 $tables = PMA_getTableList($db['name'], $tables_full[$db['name']]);
487 } elseif (isset($tables_full[strtolower($db['name'])])) {
488 // on windows with lower_case_table_names = 1
489 // MySQL returns
490 // with SHOW DATABASES or information_schema.SCHEMATA: `Test`
491 // but information_schema.TABLES gives `test`
492 // bug #1436171
493 // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408
494 $tables = PMA_getTableList($db['name'], $tables_full[strtolower($db['name'])]);
495 } else {
496 $tables = PMA_getTableList($db['name']);
498 $child_visible =
499 (bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
500 PMA_displayTableList($tables, $child_visible, '', $db['name']);
501 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
502 // no tables and LeftFrameLight:
503 // display message no tables in selected db
504 echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
506 echo '</li>' . "\n";
507 } // end foreach db
508 } // end foreach group
510 if ($close_db_group) {
511 $url_dbgroup = '';
512 echo '</ul>';
513 echo '</li>';
514 $close_db_group = false;
517 echo '</ul>' . "\n";
521 * display unordered list of tables
522 * calls itself recursively if table in given list
523 * is a list itself
525 * @uses is_array()
526 * @uses count()
527 * @uses urlencode()
528 * @uses strpos()
529 * @uses printf()
530 * @uses htmlspecialchars()
531 * @uses strlen()
532 * @uses is_array()
533 * @uses PMA_displayTableList()
534 * @uses $_REQUEST['tbl_group']
535 * @uses $GLOBALS['common_url_query']
536 * @uses $GLOBALS['table']
537 * @uses $GLOBALS['pmaThemeImage']
538 * @uses $GLOBALS['cfg']['LeftFrameTableSeparator']
539 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
540 * @uses $GLOBALS['cfg']['DefaultTabTable']
541 * @uses $GLOBALS['strRows']
542 * @uses $GLOBALS['strBrowse']
543 * @global integer the element counter
544 * @global string html code for '-' image
545 * @global string html code for '+' image
546 * @global string html code for self link
547 * @param array $tables array of tables/tablegroups
548 * @param boolean $visible wether the list is visible or not
549 * @param string $tab_group_full full tab group name
550 * @param string $table_db db of this table
552 function PMA_displayTableList($tables, $visible = false,
553 $tab_group_full = '', $table_db = '')
555 if (! is_array($tables) || count($tables) === 0) {
556 return;
559 global $element_counter, $img_minus, $img_plus, $href_left;
560 $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
562 if ($visible) {
563 echo '<ul id="subel' . $element_counter . '">';
564 } else {
565 echo '<ul id="subel' . $element_counter . '" style="display: none">';
567 foreach ($tables as $group => $table) {
568 if (isset($table['is' . $sep . 'group'])) {
569 $common_url_query = $GLOBALS['common_url_query']
570 . '&amp;tbl_group=' . urlencode($tab_group_full . $group);
572 $element_counter++;
573 echo '<li>' . "\n";
574 if ($visible
575 && ((isset($_REQUEST['tbl_group'])
576 && (strpos($_REQUEST['tbl_group'], $group) === 0
577 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
578 || strpos($GLOBALS['table'], $group) === 0)) {
579 printf($href_left, $element_counter,
580 $GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full);
581 printf($img_minus, $element_counter);
582 } else {
583 printf($href_left, $element_counter, $common_url_query);
584 printf($img_plus, $element_counter);
586 echo '</a>';
588 <a href="index.php?<?php echo $common_url_query; ?>"
589 target="_parent"
590 onclick="
591 if (! toggle('<?php echo $element_counter; ?>', true))
592 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
593 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
594 . '?' . $common_url_query; ?>', 'main');
595 return false;">
596 <?php
597 if ($GLOBALS['text_dir'] === 'rtl') {
598 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
600 echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
601 if ($GLOBALS['text_dir'] === 'ltr') {
602 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
605 </a>
606 <?php
608 unset($table['is' . $sep . 'group']);
609 unset($table['tab' . $sep . 'group']);
610 unset($table['tab' . $sep . 'count']);
612 if ($visible &&
613 ((isset($_REQUEST['tbl_group'])
614 && (strpos($_REQUEST['tbl_group'], $group) === 0
615 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
616 || strpos($GLOBALS['table'], $group) === 0)) {
617 PMA_displayTableList($table, true,
618 $tab_group_full . $group, $table_db);
619 } else {
620 PMA_displayTableList($table, false, '', $table_db);
622 echo '</li>' . "\n";
623 } elseif (is_array($table)) {
624 // quick access icon next to each table name
625 echo '<li>' . "\n";
626 echo '<a title="'
627 . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']))
628 . ': ' . htmlspecialchars($table['Comment'])
629 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows'] . ')"'
630 .' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
631 .' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
632 . $GLOBALS['common_url_query']
633 .'&amp;table=' . urlencode($table['Name'])
634 .'&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable']
635 . '" >'
636 .'<img class="icon"';
637 if ('VIEW' === strtoupper($table['Comment'])) {
638 echo ' src="' . $GLOBALS['pmaThemeImage'] . 's_views.png"';
639 } else {
640 echo ' src="' . $GLOBALS['pmaThemeImage'] . 'b_sbrowse.png"';
642 echo ' id="icon_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
643 .' width="10" height="10" alt="' . $GLOBALS['strBrowse'] . '" /></a>' . "\n";
645 // link for the table name itself
646 $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
647 .$GLOBALS['common_url_query'] . '&amp;table='
648 .urlencode($table['Name']);
649 echo '<a href="' . $href
650 . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment']
651 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows']) . ')"'
652 .' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">'
653 // preserve spaces in table name
654 . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
655 echo '</li>' . "\n";
658 echo '</ul>';
662 * get the action word corresponding to a script name
663 * in order to display it as a title in navigation panel
665 * @uses switch()
666 * @uses $GLOBALS
667 * @param string a valid value for $cfg['LeftDefaultTabTable']
668 * or $cfg['DefaultTabTable']
670 function PMA_getTitleForTarget($target) {
671 switch ($target) {
672 case 'tbl_structure.php':
673 $message = 'strStructure';
674 break;
675 case 'tbl_sql.php':
676 $message = 'strSQL';
677 break;
678 case 'tbl_select.php':
679 $message = 'strSearch';
680 break;
681 case 'tbl_change.php':
682 $message = 'strInsert';
683 break;
684 case 'sql.php':
685 $message = 'strBrowse';
686 break;
687 default:
688 $message = '';
690 return $GLOBALS[$message];
693 echo '</div>' . "\n";
695 PMA_exitNavigationFrame();