Translation is already loaded by libraries/select_lang.lib.php.
[phpmyadmin/crack.git] / navigation.php
blob25821b84bcef7118f0eee3352fc827189a4cab73
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($_REQUEST['pos'])) {
67 $_SESSION['userconf']['navi_limit_offset'] = (int) $_REQUEST['pos'];
69 $pos = $_SESSION['userconf']['navi_limit_offset'];
71 // free the session file, for the other frames to be loaded
72 // but only if debugging is not enabled
73 if (empty($_SESSION['debug'])) {
74 session_write_close();
77 /**
78 * the output compression library
80 require_once './libraries/ob.lib.php';
82 PMA_outBufferPre();
85 * selects the database if there is only one on current server
87 if ($GLOBALS['server'] && ! strlen($GLOBALS['db'])) {
88 $GLOBALS['db'] = $GLOBALS['pma']->databases->getSingleItem();
91 $db_start = $GLOBALS['db'];
93 /**
94 * the relation library
96 require_once './libraries/relation.lib.php';
97 $cfgRelation = PMA_getRelationsParam();
99 /**
100 * garvin: For re-usability, moved http-headers to a seperate file.
101 * It can now be included by libraries/header.inc.php, querywindow.php.
103 require_once './libraries/header_http.inc.php';
105 if (! isset($_SESSION['userconf']['navi_limit_offset'])) {
106 $_SESSION['userconf']['navi_limit_offset'] = 0;
108 if (isset($_REQUEST['pos'])) {
109 $_SESSION['userconf']['navi_limit_offset'] = (int) $_REQUEST['pos'];
111 $pos = $_SESSION['userconf']['navi_limit_offset'];
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.
302 * @todo instead of the 0 parameter, keep track of the
303 * offset in the list of tables ($_SESSION['userconf']['table_limit_offset'])
304 * and use PMA_listNavigator(); do not just check pos in REQUEST
305 * but add another hidden param to see if it's the pos of databases
306 * or the pos of tables.
308 $table_list = array_slice($table_list, 0, $cfg['MaxTableList']);
309 if (! empty($table_list)) {
310 PMA_displayTableList($table_list, true, '', $GLOBALS['db']);
311 // hint user that the table list is larger, until the todo is done
312 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
313 echo '&nbsp; ( 1 .. ', $GLOBALS['cfg']['MaxTableList'], ' / ', $table_count, ' )';
315 } else {
316 echo $GLOBALS['strNoTablesFound'];
318 unset($table_list);
319 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
320 echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
321 } else {
322 echo '<div id="databaseList">' . "\n";
323 $_url_params = array('pos' => $pos);
324 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
325 echo '</div>' . "\n";
327 $common_url_query = PMA_generate_common_url();
328 PMA_displayDbList($GLOBALS['pma']->databases->getGroupedDetails($_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']), $_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']);
332 * displays collapsable db list
334 * @uses $_REQUEST['dbgroup']
335 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
336 * @uses $GLOBALS['strSelectADb']
337 * @uses strpos()
338 * @uses urlencode()
339 * @uses printf()
340 * @uses htmlspecialchars()
341 * @uses PMA_generate_common_url()
342 * @uses PMA_getTableList()
343 * @uses PMA_displayTableList()
344 * @global $element_counter
345 * @global $img_minus
346 * @global $img_plus
347 * @global $href_left
348 * @global $db_start
349 * @global $common_url_query
350 * @param array $ext_dblist extended db list
351 * @param integer $offset
352 * @param integer $count
354 function PMA_displayDbList($ext_dblist, $offset, $count) {
355 global $element_counter, $img_minus, $img_plus, $href_left,
356 $db_start, $common_url_query;
358 // get table list, for all databases
359 // doing this in one step takes advantage of a single query with information_schema!
360 $tables_full = PMA_DBI_get_tables_full($GLOBALS['pma']->databases->getLimitedItems($offset, $count));
362 $url_dbgroup = '';
363 echo '<ul id="leftdatabaselist">';
364 $close_db_group = false;
365 foreach ($ext_dblist as $group => $db_group) {
366 if (count($GLOBALS['pma']->databases) > 1) {
367 if ($close_db_group) {
368 $url_dbgroup = '';
369 echo '</ul>';
370 echo '</li>';
371 $close_db_group = false;
373 if (count($db_group) > 1) {
374 $close_db_group = true;
375 $url_dbgroup = '&amp;dbgroup=' . urlencode($group);
376 $common_url_query = PMA_generate_common_url() . $url_dbgroup;
377 $element_counter++;
378 echo '<li class="dbgroup">';
379 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
380 || $db_start == $group || strpos($db_start, $group) === 0) {
381 // display + only if this db(group) is not preselected
382 printf($href_left, $element_counter, PMA_generate_common_url());
383 printf($img_minus, $element_counter);
384 } else {
385 printf($href_left, $element_counter, $common_url_query);
386 printf($img_plus, $element_counter);
388 echo '</a> ' . $group . "\n";
389 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
390 || $db_start == $group || strpos($db_start, $group) === 0) {
391 echo '<ul id="subel' . $element_counter . '">' . "\n";
392 } else {
393 echo '<ul id="subel' . $element_counter . '"'
394 .' style="display: none">' . "\n";
398 foreach ($db_group as $db) {
399 $common_url_query = PMA_generate_common_url($db['name']) . $url_dbgroup;
401 $element_counter++;
402 // Displays the database name
403 echo '<li>' . "\n";
405 if (count($GLOBALS['pma']->databases) > 1) {
406 // only with more than one db we need collapse ...
407 if ($db_start != $db['name'] || $db['num_tables'] < 1) {
408 // display + only if this db is not preselected
409 // or table count is 0
410 printf($href_left, $element_counter, $common_url_query);
411 printf($img_plus, $element_counter);
412 } else {
413 printf($href_left, $element_counter,
414 PMA_generate_common_url() . $url_dbgroup);
415 printf($img_minus, $element_counter);
417 echo '</a>';
419 // ... and we need to refresh both frames on db selection
421 <a class="item"
422 id="<?php echo htmlspecialchars($db['name']); ?>"
423 href="index.php?<?php echo $common_url_query; ?>"
424 target="_parent"
425 title="<?php echo htmlspecialchars($db['comment']); ?>"
426 onclick="
427 if (! toggle('<?php echo $element_counter; ?>', true))
428 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
429 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
430 . '?' . $common_url_query; ?>', 'main');
431 return false;">
432 <?php
433 if ($GLOBALS['text_dir'] === 'rtl') {
434 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
436 echo htmlspecialchars($db['disp_name']);
437 if ($GLOBALS['text_dir'] === 'ltr') {
438 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
441 </a>
442 <?php
443 } else {
444 // with only 1 db available we dont need to refresh left frame
445 // on db selection, only phpmain
447 <a href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
448 . '?' . $common_url_query; ?>"
449 id="<?php echo htmlspecialchars($db['name']); ?>"
450 title="<?php echo htmlspecialchars($db['comment']); ?>">
451 <?php
452 if ($GLOBALS['text_dir'] === 'rtl') {
453 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
455 echo htmlspecialchars($db['disp_name']);
456 if ($GLOBALS['text_dir'] === 'ltr') {
457 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
460 </a>
461 <?php
463 if ($db['num_tables']) {
464 if (isset($tables_full[$db['name']])) {
465 $tables = PMA_getTableList($db['name'], $tables_full[$db['name']]);
466 } elseif (isset($tables_full[strtolower($db['name'])])) {
467 // on windows with lower_case_table_names = 1
468 // MySQL returns
469 // with SHOW DATABASES or information_schema.SCHEMATA: `Test`
470 // but information_schema.TABLES gives `test`
471 // bug #1436171
472 // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408
473 $tables = PMA_getTableList($db['name'], $tables_full[strtolower($db['name'])]);
474 } else {
475 $tables = PMA_getTableList($db['name']);
477 $child_visible =
478 (bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
479 PMA_displayTableList($tables, $child_visible, '', $db['name']);
480 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
481 // no tables and LeftFrameLight:
482 // display message no tables in selected db
483 echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
485 echo '</li>' . "\n";
486 } // end foreach db
487 } // end foreach group
489 if ($close_db_group) {
490 $url_dbgroup = '';
491 echo '</ul>';
492 echo '</li>';
493 $close_db_group = false;
496 echo '</ul>' . "\n";
500 * display unordered list of tables
501 * calls itself recursively if table in given list
502 * is a list itself
504 * @uses is_array()
505 * @uses count()
506 * @uses urlencode()
507 * @uses strpos()
508 * @uses printf()
509 * @uses htmlspecialchars()
510 * @uses strlen()
511 * @uses is_array()
512 * @uses PMA_displayTableList()
513 * @uses $_REQUEST['tbl_group']
514 * @uses $GLOBALS['common_url_query']
515 * @uses $GLOBALS['table']
516 * @uses $GLOBALS['pmaThemeImage']
517 * @uses $GLOBALS['cfg']['LeftFrameTableSeparator']
518 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
519 * @uses $GLOBALS['cfg']['DefaultTabTable']
520 * @uses $GLOBALS['strRows']
521 * @uses $GLOBALS['strBrowse']
522 * @global integer the element counter
523 * @global string html code for '-' image
524 * @global string html code for '+' image
525 * @global string html code for self link
526 * @param array $tables array of tables/tablegroups
527 * @param boolean $visible wether the list is visible or not
528 * @param string $tab_group_full full tab group name
529 * @param string $table_db db of this table
531 function PMA_displayTableList($tables, $visible = false,
532 $tab_group_full = '', $table_db = '')
534 if (! is_array($tables) || count($tables) === 0) {
535 return;
538 global $element_counter, $img_minus, $img_plus, $href_left;
539 $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
541 if ($visible) {
542 echo '<ul id="subel' . $element_counter . '">';
543 } else {
544 echo '<ul id="subel' . $element_counter . '" style="display: none">';
546 foreach ($tables as $group => $table) {
547 if (isset($table['is' . $sep . 'group'])) {
548 $common_url_query = $GLOBALS['common_url_query']
549 . '&amp;tbl_group=' . urlencode($tab_group_full . $group);
551 $element_counter++;
552 echo '<li>' . "\n";
553 if ($visible
554 && ((isset($_REQUEST['tbl_group'])
555 && (strpos($_REQUEST['tbl_group'], $group) === 0
556 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
557 || strpos($GLOBALS['table'], $group) === 0)) {
558 printf($href_left, $element_counter,
559 $GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full);
560 printf($img_minus, $element_counter);
561 } else {
562 printf($href_left, $element_counter, $common_url_query);
563 printf($img_plus, $element_counter);
565 echo '</a>';
567 <a href="index.php?<?php echo $common_url_query; ?>"
568 target="_parent"
569 onclick="
570 if (! toggle('<?php echo $element_counter; ?>', true))
571 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
572 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
573 . '?' . $common_url_query; ?>', 'main');
574 return false;">
575 <?php
576 if ($GLOBALS['text_dir'] === 'rtl') {
577 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
579 echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
580 if ($GLOBALS['text_dir'] === 'ltr') {
581 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
584 </a>
585 <?php
587 unset($table['is' . $sep . 'group']);
588 unset($table['tab' . $sep . 'group']);
589 unset($table['tab' . $sep . 'count']);
591 if ($visible &&
592 ((isset($_REQUEST['tbl_group'])
593 && (strpos($_REQUEST['tbl_group'], $group) === 0
594 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
595 || strpos($GLOBALS['table'], $group) === 0)) {
596 PMA_displayTableList($table, true,
597 $tab_group_full . $group, $table_db);
598 } else {
599 PMA_displayTableList($table, false, '', $table_db);
601 echo '</li>' . "\n";
602 } elseif (is_array($table)) {
603 // quick access icon next to each table name
604 echo '<li>' . "\n";
605 echo '<a title="'
606 . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']))
607 . ': ' . htmlspecialchars($table['Comment'])
608 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows'] . ')"'
609 .' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
610 .' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
611 . $GLOBALS['common_url_query']
612 .'&amp;table=' . urlencode($table['Name'])
613 .'&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable']
614 . '" >'
615 .'<img class="icon"';
616 if ('VIEW' === strtoupper($table['Comment'])) {
617 echo ' src="' . $GLOBALS['pmaThemeImage'] . 's_views.png"';
618 } else {
619 echo ' src="' . $GLOBALS['pmaThemeImage'] . 'b_sbrowse.png"';
621 echo ' id="icon_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
622 .' width="10" height="10" alt="' . $GLOBALS['strBrowse'] . '" /></a>' . "\n";
624 // link for the table name itself
625 $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
626 .$GLOBALS['common_url_query'] . '&amp;table='
627 .urlencode($table['Name']);
628 echo '<a href="' . $href
629 . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment']
630 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows']) . ')"'
631 .' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">'
632 // preserve spaces in table name
633 . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
634 echo '</li>' . "\n";
637 echo '</ul>';
641 * get the action word corresponding to a script name
642 * in order to display it as a title in navigation panel
644 * @uses switch()
645 * @uses $GLOBALS
646 * @param string a valid value for $cfg['LeftDefaultTabTable']
647 * or $cfg['DefaultTabTable']
649 function PMA_getTitleForTarget($target) {
650 switch ($target) {
651 case 'tbl_structure.php':
652 $message = 'strStructure';
653 break;
654 case 'tbl_sql.php':
655 $message = 'strSQL';
656 break;
657 case 'tbl_select.php':
658 $message = 'strSearch';
659 break;
660 case 'tbl_change.php':
661 $message = 'strInsert';
662 break;
663 case 'sql.php':
664 $message = 'strBrowse';
665 break;
666 default:
667 $message = '';
669 return $GLOBALS[$message];
672 echo '</div>' . "\n";
674 PMA_exitNavigationFrame();