Fix incorrect array key (non_unique -> Non_unique) in qbe
[phpmyadmin.git] / navigation.php
blobaf3f138bd369829ccda628a173ec24a693d15afd
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 * @package phpMyAdmin
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['pmaThemeImage']
15 * @uses $GLOBALS['cfg']['LeftFrameLight']
16 * @uses $GLOBALS['cfg']['ShowTooltip']
17 * @uses $GLOBALS['cfg']['ShowTooltipAliasDB']
18 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
19 * @uses $GLOBALS['cfgRelation']['commwork']) {
20 * @uses PMA_List_Database::getSingleItem()
21 * @uses PMA_List_Database::getHtmlSelectGrouped()
22 * @uses PMA_List_Database::getGroupedDetails()
23 * @uses PMA_generate_common_url()
24 * @uses PMA_generate_common_hidden_inputs()
25 * @uses PMA_getDbComment();
26 * @uses PMA_getTableCount()
27 * @uses PMA_getTableList()
28 * @uses PMA_getRelationsParam()
29 * @uses PMA_outBufferPre()
30 * @uses strlen()
31 * @uses session_write_close()
32 * @uses is_array()
33 * @uses implode()
34 * @uses htmlspecialchars()
37 /**
38 * Gets a core script and starts output buffering work
40 require_once './libraries/common.inc.php';
42 /**
43 * finish and cleanup navigation.php script execution, only to be used in navigation.php
45 * @uses $GLOBALS['controllink'] to close it
46 * @uses $GLOBALS['userlink'] to close it
47 * @access private
49 function PMA_exitNavigationFrame()
51 echo '</body></html>';
52 exit;
55 require_once './libraries/common.lib.php';
56 require_once './libraries/RecentTable.class.php';
58 /**
59 * Check if it is an ajax request to reload the recent tables list.
61 if ($GLOBALS['is_ajax_request'] && $_REQUEST['recent_table']) {
62 PMA_ajaxResponse('', true, array('options' => PMA_RecentTable::getInstance()->getHtmlSelectOption()) );
65 // keep the offset of the db list in session before closing it
66 if (! isset($_SESSION['tmp_user_values']['navi_limit_offset'])) {
67 $_SESSION['tmp_user_values']['navi_limit_offset'] = 0;
69 if (! isset($_SESSION['tmp_user_values']['table_limit_offset']) || $_SESSION['tmp_user_values']['table_limit_offset_db'] != $db) {
70 $_SESSION['tmp_user_values']['table_limit_offset'] = 0;
71 $_SESSION['tmp_user_values']['table_limit_offset_db'] = $db;
73 if (isset($_REQUEST['pos'])) {
74 if (isset($_REQUEST['tpos'])) {
75 $_SESSION['tmp_user_values']['table_limit_offset'] = (int) $_REQUEST['pos'];
77 else {
78 $_SESSION['tmp_user_values']['navi_limit_offset'] = (int) $_REQUEST['pos'];
81 $pos = $_SESSION['tmp_user_values']['navi_limit_offset'];
82 $tpos = $_SESSION['tmp_user_values']['table_limit_offset'];
83 // free the session file, for the other frames to be loaded
84 // but only if debugging is not enabled
85 if (empty($_SESSION['debug'])) {
86 session_write_close();
89 /**
90 * the output compression library
92 require_once './libraries/ob.lib.php';
94 PMA_outBufferPre();
97 * selects the database if there is only one on current server
99 if ($GLOBALS['server'] && ! strlen($GLOBALS['db'])) {
100 $GLOBALS['db'] = $GLOBALS['pma']->databases->getSingleItem();
103 $db_start = $GLOBALS['db'];
106 * the relation settings
108 $cfgRelation = PMA_getRelationsParam();
111 * For re-usability, moved http-headers to a seperate file.
112 * It can now be included by libraries/header.inc.php, querywindow.php.
114 require_once './libraries/header_http.inc.php';
117 * Displays the frame
119 // xml declaration moves IE into quirks mode, making much trouble with CSS
120 /* echo '<?xml version="1.0" encoding="utf-8"?>'; */
122 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
123 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
124 <html xmlns="http://www.w3.org/1999/xhtml"
125 xml:lang="<?php echo $available_languages[$lang][1]; ?>"
126 lang="<?php echo $available_languages[$lang][1]; ?>"
127 dir="<?php echo $GLOBALS['text_dir']; ?>">
129 <head>
130 <link rel="icon" href="./favicon.ico" type="image/x-icon" />
131 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
132 <title>phpMyAdmin</title>
133 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
134 <base target="frame_content" />
135 <link rel="stylesheet" type="text/css"
136 href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=left&amp;nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
137 <?php
138 echo PMA_includeJS('jquery/jquery-1.6.1.js');
139 echo PMA_includeJS('jquery/jquery-ui-1.8.custom.js');
140 echo PMA_includeJS('navigation.js');
141 echo PMA_includeJS('functions.js');
142 echo PMA_includeJS('messages.php');
144 <script type="text/javascript">
145 // <![CDATA[
146 var image_minus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_minus.png';
147 var image_plus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_plus.png';
149 // INIT PMA_setFrameSize
150 var onloadCnt = 0;
151 var onLoadHandler = window.onload;
152 var resizeHandler = window.onresize;
153 window.document.onresize = resizeHandler;
154 window.onload = function() {
155 if (onloadCnt == 0) {
156 if (typeof(onLoadHandler) == "function") {
157 onLoadHandler();
159 if (typeof(PMA_setFrameSize) != 'undefined' && typeof(PMA_setFrameSize) == 'function') {
160 PMA_setFrameSize();
162 onloadCnt++;
165 window.onresize = function() {
166 if (typeof(resizeHandler) == "function") {
167 resizeHandler();
169 if (typeof(PMA_saveFrameSize) != 'undefined' && typeof(PMA_saveFrameSize) == 'function') {
170 PMA_saveFrameSize();
173 // ]]>
174 </script>
175 <?php
177 * remove horizontal scroll bar bug in IE 6 by forcing a vertical scroll bar
180 <!--[if IE 6]>
181 <style type="text/css">
182 /* <![CDATA[ */
183 html {
184 overflow-y: scroll;
186 /* ]]> */
187 </style>
188 <![endif]-->
189 </head>
191 <body id="body_leftFrame">
192 <?php
193 require './libraries/navigation_header.inc.php';
195 // display recently used tables
196 if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
197 echo '<div id="recentTableList">';
198 echo PMA_RecentTable::getInstance()->getHtmlSelect();
199 echo '</div>';
202 if (! $GLOBALS['server']) {
203 // no server selected
204 PMA_exitNavigationFrame();
205 } elseif (! count($GLOBALS['pma']->databases)) {
206 // no database available, so we break here
207 echo '<p>' . __('No databases') . '</p>';
208 PMA_exitNavigationFrame();
209 } elseif ($GLOBALS['cfg']['LeftFrameLight'] && count($GLOBALS['pma']->databases) > 1) {
210 $list = $cfg['DisplayDatabasesList'];
211 if ($list === 'auto') {
212 if (empty($GLOBALS['db'])) {
213 $list = true;
214 } else {
215 $list = false;
218 if (!$list) {
219 // more than one database available and LeftFrameLight is true
220 // display db selectbox
222 // Light mode -> beginning of the select combo for databases
223 // Note: When javascript is active, the frameset will be changed from
224 // within navigation.php. With no JS (<noscript>) the whole frameset will
225 // be rebuilt with the new target frame.
228 <div id="databaseList">
229 <form method="post" action="index.php" target="_parent" id="left">
230 <?php
231 echo PMA_generate_common_hidden_inputs() . "\n";
232 echo $GLOBALS['pma']->databases->getHtmlSelectGrouped(true, $_SESSION['tmp_user_values']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
233 echo '<noscript>' . "\n"
234 .'<input type="submit" name="Go" value="' . __('Go') . '" />' . "\n"
235 .'</noscript>' . "\n"
236 .'</form>' . "\n"
237 . '</div>' . "\n";
238 } else {
239 echo $GLOBALS['pma']->databases->getHtmlListGrouped(true, $_SESSION['tmp_user_values']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
241 $_url_params = array('pos' => $pos);
242 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
246 <div id="left_tableList">
247 <?php
248 // Don't display expansible/collapsible database info if:
249 // 1. $GLOBALS['server'] == 0 (no server selected)
250 // This is the case when there are multiple servers and
251 // '$GLOBALS['cfg']['ServerDefault'] = 0' is set. In that case, we want the welcome
252 // screen to appear with no database info displayed.
253 // 2. there is only one database available (ie either only one database exists
254 // or $GLOBALS['cfg']['Servers']['only_db'] is defined and is not an array)
255 // In this case, the database should not be collapsible/expandable
257 $img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"'
258 .' alt="+" />';
259 $img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"'
260 .' alt="-" />';
262 $href_left = '<a onclick="if (toggle(\'%d\')) return false;"'
263 .' href="navigation.php?%s" target="_self">';
265 $element_counter = 0;
268 if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
269 $table_list = PMA_getTableList($GLOBALS['db'], null, $tpos, $cfg['MaxTableList']);
270 $table_count = PMA_getTableCount($GLOBALS['db']);
272 // show selected databasename as link to DefaultTabDatabase-page
273 // with table count in ()
274 $common_url_query = PMA_generate_common_url($GLOBALS['db']);
276 $db_tooltip = '';
278 if ($GLOBALS['cfg']['ShowTooltip']
279 && $GLOBALS['cfgRelation']['commwork']) {
280 $_db_tooltip = PMA_getDbComment($GLOBALS['db']);
281 if ($_db_tooltip) {
282 $db_tooltip = $_db_tooltip;
286 $disp_name = $GLOBALS['db'];
287 if ($db_tooltip && $GLOBALS['cfg']['ShowTooltipAliasDB']) {
288 $disp_name = $db_tooltip;
289 $disp_name_cut = $db_tooltip;
290 $db_tooltip = $GLOBALS['db'];
293 if ($table_count >= $GLOBALS['cfg']['LeftDisplayTableFilterMinimum']) {
295 <span id="NavFilter">
296 <span id="clear_fast_filter" title="<?php echo __('Clear'); ?>">X</span>
297 <input type="text" name="fast_filter" id="fast_filter" title="<?php echo __('Filter'); ?>" value="<?php echo __('filter tables by name'); ?>" />
298 </span>
299 <?php
303 * This helps reducing the navi panel size; in the right panel,
304 * user can find a navigator to page thru all tables.
307 if (! empty($table_list)) {
308 // upper table list paginator
309 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
310 $_url_params = array(
311 'tpos' => 'true',
312 'pos' => $tpos,
313 'db' => $GLOBALS['db']
315 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
317 PMA_displayTableList($table_list, true, '', $GLOBALS['db']);
318 // lower table list paginator
319 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
320 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
322 } else {
323 echo __('No tables found in database.');
325 unset($table_list);
326 if ($db != 'information_schema') {
327 $class = '';
328 $GLOBALS['cfg']['AjaxEnable'] ? $class="ajax" : '';
329 echo '<ul id="newtable"><li><a target="frame_content" href="tbl_create.php' . PMA_generate_common_url(array('db' => $GLOBALS['db'])) . '" class="'.$class .'" >'
330 .'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_snewtbl.png" id="icon_newtable" alt="' . _pgettext('short form', 'Create table') . '" />'
331 . _pgettext('short form', 'Create table') . '</a></li></ul>';
333 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
334 /* No need to tell user to select database if we're showing complete list */
335 if (!$list) {
336 echo '<p>' . __('Please select a database') . '</p>';
338 } else {
339 echo '<div id="databaseList">' . "\n";
340 $_url_params = array('pos' => $pos);
341 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
342 echo '</div>' . "\n";
344 $common_url_query = PMA_generate_common_url();
345 PMA_displayDbList($GLOBALS['pma']->databases->getGroupedDetails($_SESSION['tmp_user_values']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']), $_SESSION['tmp_user_values']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']);
349 * displays collapsable db list
351 * @uses $_REQUEST['dbgroup']
352 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
353 * @uses strpos()
354 * @uses urlencode()
355 * @uses printf()
356 * @uses htmlspecialchars()
357 * @uses PMA_generate_common_url()
358 * @uses PMA_getTableList()
359 * @uses PMA_displayTableList()
360 * @global integer $element_counter
361 * @global string $img_minus
362 * @global string $img_plus
363 * @global string $href_left
364 * @global string $db_start
365 * @global string $common_url_query
366 * @param array $ext_dblist extended db list
367 * @param integer $offset
368 * @param integer $count
370 function PMA_displayDbList($ext_dblist, $offset, $count) {
371 global $element_counter, $img_minus, $img_plus, $href_left,
372 $db_start, $common_url_query;
374 // get table list, for all databases
375 // doing this in one step takes advantage of a single query with information_schema!
376 $tables_full = PMA_DBI_get_tables_full($GLOBALS['pma']->databases->getLimitedItems($offset, $count));
378 $url_dbgroup = '';
379 echo '<ul id="leftdatabaselist">';
380 $close_db_group = false;
381 foreach ($ext_dblist as $group => $db_group) {
382 if (count($GLOBALS['pma']->databases) > 1) {
383 if ($close_db_group) {
384 $url_dbgroup = '';
385 echo '</ul>';
386 echo '</li>';
387 $close_db_group = false;
389 if (count($db_group) > 1) {
390 $close_db_group = true;
391 $url_dbgroup = '&amp;dbgroup=' . urlencode($group);
392 $common_url_query = PMA_generate_common_url() . $url_dbgroup;
393 $element_counter++;
394 echo '<li class="dbgroup">';
395 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
396 || $db_start == $group || strpos($db_start, $group) === 0) {
397 // display + only if this db(group) is not preselected
398 printf($href_left, $element_counter, PMA_generate_common_url());
399 printf($img_minus, $element_counter);
400 } else {
401 printf($href_left, $element_counter, $common_url_query);
402 printf($img_plus, $element_counter);
404 echo '</a> ' . $group . "\n";
405 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
406 || $db_start == $group || strpos($db_start, $group) === 0) {
407 echo '<ul id="subel' . $element_counter . '">' . "\n";
408 } else {
409 echo '<ul id="subel' . $element_counter . '"'
410 .' style="display: none">' . "\n";
414 foreach ($db_group as $db) {
415 $common_url_query = PMA_generate_common_url($db['name']) . $url_dbgroup;
417 $element_counter++;
418 // Displays the database name
419 echo '<li>' . "\n";
421 if (count($GLOBALS['pma']->databases) > 1) {
422 // only with more than one db we need collapse ...
423 if ($db_start != $db['name'] || $db['num_tables'] < 1) {
424 // display + only if this db is not preselected
425 // or table count is 0
426 printf($href_left, $element_counter, $common_url_query);
427 printf($img_plus, $element_counter);
428 } else {
429 printf($href_left, $element_counter,
430 PMA_generate_common_url() . $url_dbgroup);
431 printf($img_minus, $element_counter);
433 echo '</a>';
435 // ... and we need to refresh both frames on db selection
437 <a class="item"
438 id="<?php echo htmlspecialchars($db['name']); ?>"
439 href="index.php?<?php echo $common_url_query; ?>"
440 target="_parent"
441 title="<?php echo htmlspecialchars($db['comment']); ?>"
442 onclick="
443 if (! toggle('<?php echo $element_counter; ?>', true))
444 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
445 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
446 . '?' . $common_url_query; ?>', 'main');
447 return false;">
448 <?php
449 // Might be unset if CountTables directive is false
450 if (isset($db['num_tables'])) {
451 if ($GLOBALS['text_dir'] === 'rtl') {
452 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
455 echo htmlspecialchars($db['disp_name']);
456 if (isset($db['num_tables'])) {
457 if ($GLOBALS['text_dir'] === 'ltr') {
458 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 navi 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 (isset($db['num_tables'])) {
474 if ($GLOBALS['text_dir'] === 'rtl') {
475 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
478 echo htmlspecialchars($db['disp_name']);
479 if (isset($db['num_tables'])) {
480 if ($GLOBALS['text_dir'] === 'ltr') {
481 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
485 </a>
486 <?php
488 if (($GLOBALS['cfg']['Server']['CountTables'] === false) || $db['num_tables']) {
489 if (isset($tables_full[$db['name']])) {
490 $tables = PMA_getTableList($db['name'], $tables_full[$db['name']]);
491 } elseif (isset($tables_full[strtolower($db['name'])])) {
492 // on windows with lower_case_table_names = 1
493 // MySQL returns
494 // with SHOW DATABASES or information_schema.SCHEMATA: `Test`
495 // but information_schema.TABLES gives `test`
496 // bug #1436171
497 // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408
498 $tables = PMA_getTableList($db['name'], $tables_full[strtolower($db['name'])]);
499 } else {
500 $tables = PMA_getTableList($db['name']);
502 $child_visible =
503 (bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
504 PMA_displayTableList($tables, $child_visible, '', $db['name']);
505 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
506 // no tables and LeftFrameLight:
507 // display message no tables in selected db
508 echo '<p>' . __('Please select a database') . '</p>' . "\n";
510 echo '</li>' . "\n";
511 } // end foreach db
512 } // end foreach group
514 if ($close_db_group) {
515 $url_dbgroup = '';
516 echo '</ul>';
517 echo '</li>';
518 $close_db_group = false;
521 echo '</ul>' . "\n";
525 * display unordered list of tables
526 * calls itself recursively if table in given list
527 * is a list itself
529 * @uses is_array()
530 * @uses count()
531 * @uses urlencode()
532 * @uses strpos()
533 * @uses printf()
534 * @uses htmlspecialchars()
535 * @uses strlen()
536 * @uses is_array()
537 * @uses PMA_displayTableList()
538 * @uses $_REQUEST['tbl_group']
539 * @uses $GLOBALS['common_url_query']
540 * @uses $GLOBALS['table']
541 * @uses $GLOBALS['pmaThemeImage']
542 * @uses $GLOBALS['cfg']['LeftFrameTableSeparator']
543 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
544 * @uses $GLOBALS['cfg']['DefaultTabTable']
545 * @global integer the element counter
546 * @global string html code for '-' image
547 * @global string html code for '+' image
548 * @global string html code for self link
549 * @param array $tables array of tables/tablegroups
550 * @param boolean $visible whether the list is visible or not
551 * @param string $tab_group_full full tab group name
552 * @param string $table_db db of this table
554 function PMA_displayTableList($tables, $visible = false,
555 $tab_group_full = '', $table_db = '')
557 if (! is_array($tables) || count($tables) === 0) {
558 return;
561 global $element_counter, $img_minus, $img_plus, $href_left;
562 $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
564 if ($visible) {
565 echo '<ul id="subel' . $element_counter . '">';
566 } else {
567 echo '<ul id="subel' . $element_counter . '" style="display: none">';
569 foreach ($tables as $group => $table) {
570 // only allow grouping if the group has more than 1 table
571 if (isset($table['is' . $sep . 'group']) && $table['tab' . $sep . 'count'] > 1) {
572 $common_url_query = $GLOBALS['common_url_query']
573 . '&amp;tbl_group=' . urlencode($tab_group_full . $group);
575 $element_counter++;
576 echo '<li>' . "\n";
577 if ($visible
578 && ((isset($_REQUEST['tbl_group'])
579 && (strpos($_REQUEST['tbl_group'], $group) === 0
580 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
581 || strpos($GLOBALS['table'], $group) === 0)) {
582 printf($href_left, $element_counter,
583 $GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full);
584 printf($img_minus, $element_counter);
585 } else {
586 printf($href_left, $element_counter, $common_url_query);
587 printf($img_plus, $element_counter);
589 echo '</a>';
591 <a href="index.php?<?php echo $common_url_query; ?>"
592 target="_parent"
593 onclick="
594 if (! toggle('<?php echo $element_counter; ?>', true))
595 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
596 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
597 . '?' . $common_url_query; ?>', 'main');
598 return false;">
599 <?php
600 if ($GLOBALS['text_dir'] === 'rtl') {
601 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
603 echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
604 if ($GLOBALS['text_dir'] === 'ltr') {
605 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
608 </a>
609 <?php
611 unset($table['is' . $sep . 'group']);
612 unset($table['tab' . $sep . 'group']);
613 unset($table['tab' . $sep . 'count']);
615 if ($visible &&
616 ((isset($_REQUEST['tbl_group'])
617 && (strpos($_REQUEST['tbl_group'], $group) === 0
618 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
619 || strpos($GLOBALS['table'], $group) === 0)) {
620 PMA_displayTableList($table, true,
621 $tab_group_full . $group, $table_db);
622 } else {
623 PMA_displayTableList($table, false, '', $table_db);
625 echo '</li>' . "\n";
626 } elseif (is_array($table)) {
627 // the table was not grouped because it is the only one with its prefix
628 while (isset($table['is' . $sep . 'group'])) {
629 // get the array with the actual table information
630 foreach ($table as $value) {
631 if(is_array($value)) {
632 $table = $value;
636 $link_title = PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']);
637 // quick access icon next to each table name
638 echo '<li>' . "\n";
639 echo '<a class="tableicon" title="'
640 . htmlspecialchars($link_title)
641 . ': ' . htmlspecialchars($table['Comment'])
642 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"'
643 .' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
644 .' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
645 . $GLOBALS['common_url_query']
646 .'&amp;table=' . urlencode($table['Name'])
647 .'&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable']
648 . '" >'
649 .'<img class="icon"';
650 if ('VIEW' === strtoupper($table['Comment'])) {
651 echo ' src="' . $GLOBALS['pmaThemeImage'] . 's_views.png"';
652 } else {
653 echo ' src="' . $GLOBALS['pmaThemeImage'] . 'b_sbrowse.png"';
655 echo ' id="icon_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
656 .' alt="' . htmlspecialchars($link_title) . '" /></a>' . "\n";
658 // link for the table name itself
659 $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
660 .$GLOBALS['common_url_query'] . '&amp;table='
661 .urlencode($table['Name']) . '&amp;pos=0';
662 echo '<a href="' . $href
663 . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment']
664 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows')) . ')"'
665 .' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">'
666 // preserve spaces in table name
667 . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
668 echo '</li>' . "\n";
671 echo '</ul>';
674 echo '</div>' . "\n";
676 PMA_exitNavigationFrame();