duplicate code
[phpmyadmin/crack.git] / navigation.php
blob49e266280ffe27b385a313540806eb9bb960d19e
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';
114 * Displays the frame
116 // xml declaration moves IE into quirks mode, making much trouble with CSS
117 /* echo '<?xml version="1.0" encoding="' . $GLOBALS['charset'] . '"?>'; */
119 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
120 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
121 <html xmlns="http://www.w3.org/1999/xhtml"
122 xml:lang="<?php echo $available_languages[$lang][2]; ?>"
123 lang="<?php echo $available_languages[$lang][2]; ?>"
124 dir="<?php echo $GLOBALS['text_dir']; ?>">
126 <head>
127 <link rel="icon" href="./favicon.ico" type="image/x-icon" />
128 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
129 <title>phpMyAdmin</title>
130 <meta http-equiv="Content-Type"
131 content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
132 <base target="frame_content" />
133 <link rel="stylesheet" type="text/css"
134 href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=left&amp;nocache=<?php echo $_SESSION['PMA_Config']->getThemeUniqueValue(); ?>" />
135 <script type="text/javascript" src="js/navigation.js"></script>
136 <script type="text/javascript" src="js/functions.js"></script>
137 <script type="text/javascript">
138 // <![CDATA[
139 var image_minus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_minus.png';
140 var image_plus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_plus.png';
142 // INIT PMA_setFrameSize
143 var onloadCnt = 0;
144 var onLoadHandler = window.onload;
145 var resizeHandler = window.onresize;
146 window.document.onresize = resizeHandler;
147 window.onload = function() {
148 if (onloadCnt == 0) {
149 if (typeof(onLoadHandler) == "function") {
150 onLoadHandler();
152 if (typeof(PMA_setFrameSize) != 'undefined' && typeof(PMA_setFrameSize) == 'function') {
153 PMA_setFrameSize();
155 onloadCnt++;
158 window.onresize = function() {
159 if (typeof(resizeHandler) == "function") {
160 resizeHandler();
162 if (typeof(PMA_saveFrameSize) != 'undefined' && typeof(PMA_saveFrameSize) == 'function') {
163 PMA_saveFrameSize();
166 // ]]>
167 </script>
168 <?php
170 * remove horizontal scroll bar bug in IE 6 by forcing a vertical scroll bar
173 <!--[if IE 6]>
174 <style type="text/css">
175 /* <![CDATA[ */
176 html {
177 overflow-y: scroll;
179 /* ]]> */
180 </style>
181 <![endif]-->
182 </head>
184 <body id="body_leftFrame">
185 <?php
186 require './libraries/navigation_header.inc.php';
187 if (! $GLOBALS['server']) {
188 // no server selected
189 PMA_exitNavigationFrame();
190 } elseif (! count($GLOBALS['pma']->databases)) {
191 // no database available, so we break here
192 echo '<p>' . $GLOBALS['strNoDatabases'] . '</p>';
193 PMA_exitNavigationFrame();
194 } elseif ($GLOBALS['cfg']['LeftFrameLight'] && count($GLOBALS['pma']->databases) > 1) {
195 $list = $cfg['DisplayDatabasesList'];
196 if ($list === 'auto') {
197 if (empty($GLOBALS['db'])) {
198 $list = true;
199 } else {
200 $list = false;
203 if (!$list) {
204 // more than one database available and LeftFrameLight is true
205 // display db selectbox
207 // Light mode -> beginning of the select combo for databases
208 // Note: When javascript is active, the frameset will be changed from
209 // within navigation.php. With no JS (<noscript>) the whole frameset will
210 // be rebuilt with the new target frame.
213 <div id="databaseList">
214 <form method="post" action="index.php" target="_parent" id="left">
215 <label for="lightm_db"><?php echo $GLOBALS['strDatabase']; ?></label>
216 <?php
217 echo PMA_generate_common_hidden_inputs() . "\n";
218 echo $GLOBALS['pma']->databases->getHtmlSelectGrouped(true, $_SESSION['userconf']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
219 echo '<noscript>' . "\n"
220 .'<input type="submit" name="Go" value="' . $GLOBALS['strGo'] . '" />' . "\n"
221 .'</noscript>' . "\n"
222 .'</form>' . "\n";
223 } else {
224 if (! empty($db)) {
225 echo '<div id="databaseList">' . "\n";
227 echo $GLOBALS['pma']->databases->getHtmlListGrouped(true, $_SESSION['userconf']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
229 $_url_params = array('pos' => $pos);
230 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
231 if (! empty($db)) {
232 echo '</div>' . "\n";
237 <div id="left_tableList">
238 <?php
239 // Don't display expansible/collapsible database info if:
240 // 1. $GLOBALS['server'] == 0 (no server selected)
241 // This is the case when there are multiple servers and
242 // '$GLOBALS['cfg']['ServerDefault'] = 0' is set. In that case, we want the welcome
243 // screen to appear with no database info displayed.
244 // 2. there is only one database available (ie either only one database exists
245 // or $GLOBALS['cfg']['Servers']['only_db'] is defined and is not an array)
246 // In this case, the database should not be collapsible/expandable
248 $img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"'
249 .' width="9" height="9" alt="+" />';
250 $img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"'
251 .' width="9" height="9" alt="-" />';
253 $href_left = '<a onclick="if (toggle(\'%d\')) return false;"'
254 .' href="navigation.php?%s" target="_self">';
256 $element_counter = 0;
259 if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
260 $table_list = PMA_getTableList($GLOBALS['db']);
261 $table_count = count($table_list);
263 // show selected databasename as link to DefaultTabDatabase-page
264 // with table count in ()
265 $common_url_query = PMA_generate_common_url($GLOBALS['db']);
267 $db_tooltip = '';
269 if ($GLOBALS['cfg']['ShowTooltip']
270 && $GLOBALS['cfgRelation']['commwork']) {
271 $_db_tooltip = PMA_getDbComment($GLOBALS['db']);
272 if ($_db_tooltip) {
273 $db_tooltip = $_db_tooltip;
277 $disp_name = $GLOBALS['db'];
278 if ($db_tooltip && $GLOBALS['cfg']['ShowTooltipAliasDB']) {
279 $disp_name = $db_tooltip;
280 $disp_name_cut = $db_tooltip;
281 $db_tooltip = $GLOBALS['db'];
285 <p><a class="item"
286 href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query; ?>"
287 title="<?php echo htmlspecialchars($db_tooltip); ?>" >
288 <?php
289 if ($GLOBALS['text_dir'] === 'rtl') {
290 echo ' <bdo dir="ltr">(' . $table_count . ')</bdo> ';
292 echo '<span class="navi_dbName">' . htmlspecialchars($disp_name) . '</span>';
293 if ($GLOBALS['text_dir'] === 'ltr') {
294 echo ' <bdo dir="ltr">(' . $table_count . ')</bdo> ';
296 echo '</a></p>';
299 * This helps reducing the navi panel size; in the right panel,
300 * user can find a navigator to page thru all tables.
303 $table_list = array_slice($table_list, $tpos, $cfg['MaxTableList']);
304 if (! empty($table_list)) {
305 // upper table list paginator
306 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
307 $_url_params = array(
308 'tpos' => 'true',
309 'pos' => $tpos,
310 'db' => $GLOBALS['db']
312 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
314 PMA_displayTableList($table_list, true, '', $GLOBALS['db']);
315 // lower table list paginator
316 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
317 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
319 } else {
320 echo $GLOBALS['strNoTablesFound'];
322 unset($table_list);
323 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
324 echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
325 } else {
326 echo '<div id="databaseList">' . "\n";
327 $_url_params = array('pos' => $pos);
328 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
329 echo '</div>' . "\n";
331 $common_url_query = PMA_generate_common_url();
332 PMA_displayDbList($GLOBALS['pma']->databases->getGroupedDetails($_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']), $_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']);
336 * displays collapsable db list
338 * @uses $_REQUEST['dbgroup']
339 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
340 * @uses $GLOBALS['strSelectADb']
341 * @uses strpos()
342 * @uses urlencode()
343 * @uses printf()
344 * @uses htmlspecialchars()
345 * @uses PMA_generate_common_url()
346 * @uses PMA_getTableList()
347 * @uses PMA_displayTableList()
348 * @global $element_counter
349 * @global $img_minus
350 * @global $img_plus
351 * @global $href_left
352 * @global $db_start
353 * @global $common_url_query
354 * @param array $ext_dblist extended db list
355 * @param integer $offset
356 * @param integer $count
358 function PMA_displayDbList($ext_dblist, $offset, $count) {
359 global $element_counter, $img_minus, $img_plus, $href_left,
360 $db_start, $common_url_query;
362 // get table list, for all databases
363 // doing this in one step takes advantage of a single query with information_schema!
364 $tables_full = PMA_DBI_get_tables_full($GLOBALS['pma']->databases->getLimitedItems($offset, $count));
366 $url_dbgroup = '';
367 echo '<ul id="leftdatabaselist">';
368 $close_db_group = false;
369 foreach ($ext_dblist as $group => $db_group) {
370 if (count($GLOBALS['pma']->databases) > 1) {
371 if ($close_db_group) {
372 $url_dbgroup = '';
373 echo '</ul>';
374 echo '</li>';
375 $close_db_group = false;
377 if (count($db_group) > 1) {
378 $close_db_group = true;
379 $url_dbgroup = '&amp;dbgroup=' . urlencode($group);
380 $common_url_query = PMA_generate_common_url() . $url_dbgroup;
381 $element_counter++;
382 echo '<li class="dbgroup">';
383 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
384 || $db_start == $group || strpos($db_start, $group) === 0) {
385 // display + only if this db(group) is not preselected
386 printf($href_left, $element_counter, PMA_generate_common_url());
387 printf($img_minus, $element_counter);
388 } else {
389 printf($href_left, $element_counter, $common_url_query);
390 printf($img_plus, $element_counter);
392 echo '</a> ' . $group . "\n";
393 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
394 || $db_start == $group || strpos($db_start, $group) === 0) {
395 echo '<ul id="subel' . $element_counter . '">' . "\n";
396 } else {
397 echo '<ul id="subel' . $element_counter . '"'
398 .' style="display: none">' . "\n";
402 foreach ($db_group as $db) {
403 $common_url_query = PMA_generate_common_url($db['name']) . $url_dbgroup;
405 $element_counter++;
406 // Displays the database name
407 echo '<li>' . "\n";
409 if (count($GLOBALS['pma']->databases) > 1) {
410 // only with more than one db we need collapse ...
411 if ($db_start != $db['name'] || $db['num_tables'] < 1) {
412 // display + only if this db is not preselected
413 // or table count is 0
414 printf($href_left, $element_counter, $common_url_query);
415 printf($img_plus, $element_counter);
416 } else {
417 printf($href_left, $element_counter,
418 PMA_generate_common_url() . $url_dbgroup);
419 printf($img_minus, $element_counter);
421 echo '</a>';
423 // ... and we need to refresh both frames on db selection
425 <a class="item"
426 id="<?php echo htmlspecialchars($db['name']); ?>"
427 href="index.php?<?php echo $common_url_query; ?>"
428 target="_parent"
429 title="<?php echo htmlspecialchars($db['comment']); ?>"
430 onclick="
431 if (! toggle('<?php echo $element_counter; ?>', true))
432 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
433 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
434 . '?' . $common_url_query; ?>', 'main');
435 return false;">
436 <?php
437 if ($GLOBALS['text_dir'] === 'rtl') {
438 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
440 echo htmlspecialchars($db['disp_name']);
441 if ($GLOBALS['text_dir'] === 'ltr') {
442 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
445 </a>
446 <?php
447 } else {
448 // with only 1 db available we dont need to refresh left frame
449 // on db selection, only phpmain
451 <a href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
452 . '?' . $common_url_query; ?>"
453 id="<?php echo htmlspecialchars($db['name']); ?>"
454 title="<?php echo htmlspecialchars($db['comment']); ?>">
455 <?php
456 if ($GLOBALS['text_dir'] === 'rtl') {
457 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
459 echo htmlspecialchars($db['disp_name']);
460 if ($GLOBALS['text_dir'] === 'ltr') {
461 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
464 </a>
465 <?php
467 if ($db['num_tables']) {
468 if (isset($tables_full[$db['name']])) {
469 $tables = PMA_getTableList($db['name'], $tables_full[$db['name']]);
470 } elseif (isset($tables_full[strtolower($db['name'])])) {
471 // on windows with lower_case_table_names = 1
472 // MySQL returns
473 // with SHOW DATABASES or information_schema.SCHEMATA: `Test`
474 // but information_schema.TABLES gives `test`
475 // bug #1436171
476 // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408
477 $tables = PMA_getTableList($db['name'], $tables_full[strtolower($db['name'])]);
478 } else {
479 $tables = PMA_getTableList($db['name']);
481 $child_visible =
482 (bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
483 PMA_displayTableList($tables, $child_visible, '', $db['name']);
484 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
485 // no tables and LeftFrameLight:
486 // display message no tables in selected db
487 echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
489 echo '</li>' . "\n";
490 } // end foreach db
491 } // end foreach group
493 if ($close_db_group) {
494 $url_dbgroup = '';
495 echo '</ul>';
496 echo '</li>';
497 $close_db_group = false;
500 echo '</ul>' . "\n";
504 * display unordered list of tables
505 * calls itself recursively if table in given list
506 * is a list itself
508 * @uses is_array()
509 * @uses count()
510 * @uses urlencode()
511 * @uses strpos()
512 * @uses printf()
513 * @uses htmlspecialchars()
514 * @uses strlen()
515 * @uses is_array()
516 * @uses PMA_displayTableList()
517 * @uses $_REQUEST['tbl_group']
518 * @uses $GLOBALS['common_url_query']
519 * @uses $GLOBALS['table']
520 * @uses $GLOBALS['pmaThemeImage']
521 * @uses $GLOBALS['cfg']['LeftFrameTableSeparator']
522 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
523 * @uses $GLOBALS['cfg']['DefaultTabTable']
524 * @uses $GLOBALS['strRows']
525 * @uses $GLOBALS['strBrowse']
526 * @global integer the element counter
527 * @global string html code for '-' image
528 * @global string html code for '+' image
529 * @global string html code for self link
530 * @param array $tables array of tables/tablegroups
531 * @param boolean $visible whether the list is visible or not
532 * @param string $tab_group_full full tab group name
533 * @param string $table_db db of this table
535 function PMA_displayTableList($tables, $visible = false,
536 $tab_group_full = '', $table_db = '')
538 if (! is_array($tables) || count($tables) === 0) {
539 return;
542 global $element_counter, $img_minus, $img_plus, $href_left;
543 $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
545 if ($visible) {
546 echo '<ul id="subel' . $element_counter . '">';
547 } else {
548 echo '<ul id="subel' . $element_counter . '" style="display: none">';
550 foreach ($tables as $group => $table) {
551 if (isset($table['is' . $sep . 'group'])) {
552 $common_url_query = $GLOBALS['common_url_query']
553 . '&amp;tbl_group=' . urlencode($tab_group_full . $group);
555 $element_counter++;
556 echo '<li>' . "\n";
557 if ($visible
558 && ((isset($_REQUEST['tbl_group'])
559 && (strpos($_REQUEST['tbl_group'], $group) === 0
560 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
561 || strpos($GLOBALS['table'], $group) === 0)) {
562 printf($href_left, $element_counter,
563 $GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full);
564 printf($img_minus, $element_counter);
565 } else {
566 printf($href_left, $element_counter, $common_url_query);
567 printf($img_plus, $element_counter);
569 echo '</a>';
571 <a href="index.php?<?php echo $common_url_query; ?>"
572 target="_parent"
573 onclick="
574 if (! toggle('<?php echo $element_counter; ?>', true))
575 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
576 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
577 . '?' . $common_url_query; ?>', 'main');
578 return false;">
579 <?php
580 if ($GLOBALS['text_dir'] === 'rtl') {
581 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
583 echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
584 if ($GLOBALS['text_dir'] === 'ltr') {
585 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
588 </a>
589 <?php
591 unset($table['is' . $sep . 'group']);
592 unset($table['tab' . $sep . 'group']);
593 unset($table['tab' . $sep . 'count']);
595 if ($visible &&
596 ((isset($_REQUEST['tbl_group'])
597 && (strpos($_REQUEST['tbl_group'], $group) === 0
598 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
599 || strpos($GLOBALS['table'], $group) === 0)) {
600 PMA_displayTableList($table, true,
601 $tab_group_full . $group, $table_db);
602 } else {
603 PMA_displayTableList($table, false, '', $table_db);
605 echo '</li>' . "\n";
606 } elseif (is_array($table)) {
607 // quick access icon next to each table name
608 echo '<li>' . "\n";
609 echo '<a title="'
610 . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']))
611 . ': ' . htmlspecialchars($table['Comment'])
612 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows'] . ')"'
613 .' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
614 .' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
615 . $GLOBALS['common_url_query']
616 .'&amp;table=' . urlencode($table['Name'])
617 .'&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable']
618 . '" >'
619 .'<img class="icon"';
620 if ('VIEW' === strtoupper($table['Comment'])) {
621 echo ' src="' . $GLOBALS['pmaThemeImage'] . 's_views.png"';
622 } else {
623 echo ' src="' . $GLOBALS['pmaThemeImage'] . 'b_sbrowse.png"';
625 echo ' id="icon_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
626 .' width="10" height="10" alt="' . $GLOBALS['strBrowse'] . '" /></a>' . "\n";
628 // link for the table name itself
629 $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
630 .$GLOBALS['common_url_query'] . '&amp;table='
631 .urlencode($table['Name']) . '&amp;pos=0';
632 echo '<a href="' . $href
633 . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment']
634 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows']) . ')"'
635 .' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">'
636 // preserve spaces in table name
637 . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
638 echo '</li>' . "\n";
641 echo '</ul>';
645 * get the action word corresponding to a script name
646 * in order to display it as a title in navigation panel
648 * @uses switch()
649 * @uses $GLOBALS
650 * @param string a valid value for $cfg['LeftDefaultTabTable']
651 * or $cfg['DefaultTabTable']
653 function PMA_getTitleForTarget($target) {
654 switch ($target) {
655 case 'tbl_structure.php':
656 $message = 'strStructure';
657 break;
658 case 'tbl_sql.php':
659 $message = 'strSQL';
660 break;
661 case 'tbl_select.php':
662 $message = 'strSearch';
663 break;
664 case 'tbl_change.php':
665 $message = 'strInsert';
666 break;
667 case 'sql.php':
668 $message = 'strBrowse';
669 break;
670 default:
671 $message = '';
673 return $GLOBALS[$message];
676 echo '</div>' . "\n";
678 PMA_exitNavigationFrame();