Fix typo in translation.
[phpmyadmin/crack.git] / navigation.php
blob70928a0bd038ca30c6f18187e110f0c8d1e6c628
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']) || $_SESSION['userconf']['table_limit_offset_db'] != $db) {
67 $_SESSION['userconf']['table_limit_offset'] = 0;
68 $_SESSION['userconf']['table_limit_offset_db'] = $db;
70 if (isset($_REQUEST['pos'])) {
71 if (isset($_REQUEST['tpos'])) {
72 $_SESSION['userconf']['table_limit_offset'] = (int) $_REQUEST['pos'];
74 else {
75 $_SESSION['userconf']['navi_limit_offset'] = (int) $_REQUEST['pos'];
78 $pos = $_SESSION['userconf']['navi_limit_offset'];
79 $tpos = $_SESSION['userconf']['table_limit_offset'];
80 // free the session file, for the other frames to be loaded
81 // but only if debugging is not enabled
82 if (empty($_SESSION['debug'])) {
83 session_write_close();
86 /**
87 * the output compression library
89 require_once './libraries/ob.lib.php';
91 PMA_outBufferPre();
94 * selects the database if there is only one on current server
96 if ($GLOBALS['server'] && ! strlen($GLOBALS['db'])) {
97 $GLOBALS['db'] = $GLOBALS['pma']->databases->getSingleItem();
100 $db_start = $GLOBALS['db'];
103 * the relation library
105 require_once './libraries/relation.lib.php';
106 $cfgRelation = PMA_getRelationsParam();
109 * garvin: For re-usability, moved http-headers to a seperate file.
110 * It can now be included by libraries/header.inc.php, querywindow.php.
112 require_once './libraries/header_http.inc.php';
115 * Displays the frame
117 // xml declaration moves IE into quirks mode, making much trouble with CSS
118 /* echo '<?xml version="1.0" encoding="' . $GLOBALS['charset'] . '"?>'; */
120 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
121 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
122 <html xmlns="http://www.w3.org/1999/xhtml"
123 xml:lang="<?php echo $available_languages[$lang][2]; ?>"
124 lang="<?php echo $available_languages[$lang][2]; ?>"
125 dir="<?php echo $GLOBALS['text_dir']; ?>">
127 <head>
128 <link rel="icon" href="./favicon.ico" type="image/x-icon" />
129 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
130 <title>phpMyAdmin</title>
131 <meta http-equiv="Content-Type"
132 content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
133 <base target="frame_content" />
134 <link rel="stylesheet" type="text/css"
135 href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=left&amp;nocache=<?php echo $_SESSION['PMA_Config']->getThemeUniqueValue(); ?>" />
136 <script type="text/javascript" src="js/navigation.js"></script>
137 <script type="text/javascript" src="js/functions.js"></script>
138 <script type="text/javascript">
139 // <![CDATA[
140 var image_minus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_minus.png';
141 var image_plus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_plus.png';
143 // INIT PMA_setFrameSize
144 var onloadCnt = 0;
145 var onLoadHandler = window.onload;
146 var resizeHandler = window.onresize;
147 window.document.onresize = resizeHandler;
148 window.onload = function() {
149 if (onloadCnt == 0) {
150 if (typeof(onLoadHandler) == "function") {
151 onLoadHandler();
153 if (typeof(PMA_setFrameSize) != 'undefined' && typeof(PMA_setFrameSize) == 'function') {
154 PMA_setFrameSize();
156 onloadCnt++;
159 window.onresize = function() {
160 if (typeof(resizeHandler) == "function") {
161 resizeHandler();
163 if (typeof(PMA_saveFrameSize) != 'undefined' && typeof(PMA_saveFrameSize) == 'function') {
164 PMA_saveFrameSize();
167 // ]]>
168 </script>
169 <?php
171 * remove horizontal scroll bar bug in IE 6 by forcing a vertical scroll bar
174 <!--[if IE 6]>
175 <style type="text/css">
176 /* <![CDATA[ */
177 html {
178 overflow-y: scroll;
180 /* ]]> */
181 </style>
182 <![endif]-->
183 </head>
185 <body id="body_leftFrame">
186 <?php
187 require './libraries/navigation_header.inc.php';
188 if (! $GLOBALS['server']) {
189 // no server selected
190 PMA_exitNavigationFrame();
191 } elseif (! count($GLOBALS['pma']->databases)) {
192 // no database available, so we break here
193 echo '<p>' . $GLOBALS['strNoDatabases'] . '</p>';
194 PMA_exitNavigationFrame();
195 } elseif ($GLOBALS['cfg']['LeftFrameLight'] && count($GLOBALS['pma']->databases) > 1) {
196 $list = $cfg['DisplayDatabasesList'];
197 if ($list === 'auto') {
198 if (empty($GLOBALS['db'])) {
199 $list = true;
200 } else {
201 $list = false;
204 if (!$list) {
205 // more than one database available and LeftFrameLight is true
206 // display db selectbox
208 // Light mode -> beginning of the select combo for databases
209 // Note: When javascript is active, the frameset will be changed from
210 // within navigation.php. With no JS (<noscript>) the whole frameset will
211 // be rebuilt with the new target frame.
214 <div id="databaseList">
215 <form method="post" action="index.php" target="_parent" id="left">
216 <label for="lightm_db"><?php echo $GLOBALS['strDatabase']; ?></label>
217 <?php
218 echo PMA_generate_common_hidden_inputs() . "\n";
219 echo $GLOBALS['pma']->databases->getHtmlSelectGrouped(true, $_SESSION['userconf']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
220 echo '<noscript>' . "\n"
221 .'<input type="submit" name="Go" value="' . $GLOBALS['strGo'] . '" />' . "\n"
222 .'</noscript>' . "\n"
223 .'</form>' . "\n";
224 } else {
225 if (! empty($db)) {
226 echo '<div id="databaseList">' . "\n";
228 echo $GLOBALS['pma']->databases->getHtmlListGrouped(true, $_SESSION['userconf']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
230 $_url_params = array('pos' => $pos);
231 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
232 if (! empty($db)) {
233 echo '</div>' . "\n";
238 <div id="left_tableList">
239 <?php
240 // Don't display expansible/collapsible database info if:
241 // 1. $GLOBALS['server'] == 0 (no server selected)
242 // This is the case when there are multiple servers and
243 // '$GLOBALS['cfg']['ServerDefault'] = 0' is set. In that case, we want the welcome
244 // screen to appear with no database info displayed.
245 // 2. there is only one database available (ie either only one database exists
246 // or $GLOBALS['cfg']['Servers']['only_db'] is defined and is not an array)
247 // In this case, the database should not be collapsible/expandable
249 $img_plus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_plus.png"'
250 .' width="9" height="9" alt="+" />';
251 $img_minus = '<img class="icon" id="el%dImg" src="' . $pmaThemeImage . 'b_minus.png"'
252 .' width="9" height="9" alt="-" />';
254 $href_left = '<a onclick="if (toggle(\'%d\')) return false;"'
255 .' href="navigation.php?%s" target="_self">';
257 $element_counter = 0;
260 if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
261 $table_list = PMA_getTableList($GLOBALS['db']);
262 $table_count = count($table_list);
264 // show selected databasename as link to DefaultTabDatabase-page
265 // with table count in ()
266 $common_url_query = PMA_generate_common_url($GLOBALS['db']);
268 $db_tooltip = '';
270 if ($GLOBALS['cfg']['ShowTooltip']
271 && $GLOBALS['cfgRelation']['commwork']) {
272 $_db_tooltip = PMA_getDbComment($GLOBALS['db']);
273 if ($_db_tooltip) {
274 $db_tooltip = $_db_tooltip;
278 $disp_name = $GLOBALS['db'];
279 if ($db_tooltip && $GLOBALS['cfg']['ShowTooltipAliasDB']) {
280 $disp_name = $db_tooltip;
281 $disp_name_cut = $db_tooltip;
282 $db_tooltip = $GLOBALS['db'];
286 <p><a class="item"
287 href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query; ?>"
288 title="<?php echo htmlspecialchars($db_tooltip); ?>" >
289 <?php
290 if ($GLOBALS['text_dir'] === 'rtl') {
291 echo ' <bdo dir="ltr">(' . $table_count . ')</bdo> ';
293 echo '<span class="navi_dbName">' . htmlspecialchars($disp_name) . '</span>';
294 if ($GLOBALS['text_dir'] === 'ltr') {
295 echo ' <bdo dir="ltr">(' . $table_count . ')</bdo> ';
297 echo '</a></p>';
300 * This helps reducing the navi panel size; in the right panel,
301 * user can find a navigator to page thru all tables.
304 $table_list = array_slice($table_list, $tpos, $cfg['MaxTableList']);
305 if (! empty($table_list)) {
306 // upper table list paginator
307 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
308 $_url_params = array(
309 'tpos' => 'true',
310 'pos' => $tpos,
311 'db' => $GLOBALS['db']
313 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
315 PMA_displayTableList($table_list, true, '', $GLOBALS['db']);
316 // lower table list paginator
317 if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList']) {
318 PMA_listNavigator($table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList']);
320 } else {
321 echo $GLOBALS['strNoTablesFound'];
323 unset($table_list);
324 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
325 echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
326 } else {
327 echo '<div id="databaseList">' . "\n";
328 $_url_params = array('pos' => $pos);
329 PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
330 echo '</div>' . "\n";
332 $common_url_query = PMA_generate_common_url();
333 PMA_displayDbList($GLOBALS['pma']->databases->getGroupedDetails($_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']), $_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']);
337 * displays collapsable db list
339 * @uses $_REQUEST['dbgroup']
340 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
341 * @uses $GLOBALS['strSelectADb']
342 * @uses strpos()
343 * @uses urlencode()
344 * @uses printf()
345 * @uses htmlspecialchars()
346 * @uses PMA_generate_common_url()
347 * @uses PMA_getTableList()
348 * @uses PMA_displayTableList()
349 * @global $element_counter
350 * @global $img_minus
351 * @global $img_plus
352 * @global $href_left
353 * @global $db_start
354 * @global $common_url_query
355 * @param array $ext_dblist extended db list
356 * @param integer $offset
357 * @param integer $count
359 function PMA_displayDbList($ext_dblist, $offset, $count) {
360 global $element_counter, $img_minus, $img_plus, $href_left,
361 $db_start, $common_url_query;
363 // get table list, for all databases
364 // doing this in one step takes advantage of a single query with information_schema!
365 $tables_full = PMA_DBI_get_tables_full($GLOBALS['pma']->databases->getLimitedItems($offset, $count));
367 $url_dbgroup = '';
368 echo '<ul id="leftdatabaselist">';
369 $close_db_group = false;
370 foreach ($ext_dblist as $group => $db_group) {
371 if (count($GLOBALS['pma']->databases) > 1) {
372 if ($close_db_group) {
373 $url_dbgroup = '';
374 echo '</ul>';
375 echo '</li>';
376 $close_db_group = false;
378 if (count($db_group) > 1) {
379 $close_db_group = true;
380 $url_dbgroup = '&amp;dbgroup=' . urlencode($group);
381 $common_url_query = PMA_generate_common_url() . $url_dbgroup;
382 $element_counter++;
383 echo '<li class="dbgroup">';
384 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
385 || $db_start == $group || strpos($db_start, $group) === 0) {
386 // display + only if this db(group) is not preselected
387 printf($href_left, $element_counter, PMA_generate_common_url());
388 printf($img_minus, $element_counter);
389 } else {
390 printf($href_left, $element_counter, $common_url_query);
391 printf($img_plus, $element_counter);
393 echo '</a> ' . $group . "\n";
394 if ((! empty($_REQUEST['dbgroup']) && $_REQUEST['dbgroup'] == $group)
395 || $db_start == $group || strpos($db_start, $group) === 0) {
396 echo '<ul id="subel' . $element_counter . '">' . "\n";
397 } else {
398 echo '<ul id="subel' . $element_counter . '"'
399 .' style="display: none">' . "\n";
403 foreach ($db_group as $db) {
404 $common_url_query = PMA_generate_common_url($db['name']) . $url_dbgroup;
406 $element_counter++;
407 // Displays the database name
408 echo '<li>' . "\n";
410 if (count($GLOBALS['pma']->databases) > 1) {
411 // only with more than one db we need collapse ...
412 if ($db_start != $db['name'] || $db['num_tables'] < 1) {
413 // display + only if this db is not preselected
414 // or table count is 0
415 printf($href_left, $element_counter, $common_url_query);
416 printf($img_plus, $element_counter);
417 } else {
418 printf($href_left, $element_counter,
419 PMA_generate_common_url() . $url_dbgroup);
420 printf($img_minus, $element_counter);
422 echo '</a>';
424 // ... and we need to refresh both frames on db selection
426 <a class="item"
427 id="<?php echo htmlspecialchars($db['name']); ?>"
428 href="index.php?<?php echo $common_url_query; ?>"
429 target="_parent"
430 title="<?php echo htmlspecialchars($db['comment']); ?>"
431 onclick="
432 if (! toggle('<?php echo $element_counter; ?>', true))
433 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
434 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
435 . '?' . $common_url_query; ?>', 'main');
436 return false;">
437 <?php
438 if ($GLOBALS['text_dir'] === 'rtl') {
439 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
441 echo htmlspecialchars($db['disp_name']);
442 if ($GLOBALS['text_dir'] === 'ltr') {
443 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
446 </a>
447 <?php
448 } else {
449 // with only 1 db available we dont need to refresh left frame
450 // on db selection, only phpmain
452 <a href="<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
453 . '?' . $common_url_query; ?>"
454 id="<?php echo htmlspecialchars($db['name']); ?>"
455 title="<?php echo htmlspecialchars($db['comment']); ?>">
456 <?php
457 if ($GLOBALS['text_dir'] === 'rtl') {
458 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
460 echo htmlspecialchars($db['disp_name']);
461 if ($GLOBALS['text_dir'] === 'ltr') {
462 echo ' <bdo dir="ltr">(' . $db['num_tables'] . ')</bdo> ';
465 </a>
466 <?php
468 if ($db['num_tables']) {
469 if (isset($tables_full[$db['name']])) {
470 $tables = PMA_getTableList($db['name'], $tables_full[$db['name']]);
471 } elseif (isset($tables_full[strtolower($db['name'])])) {
472 // on windows with lower_case_table_names = 1
473 // MySQL returns
474 // with SHOW DATABASES or information_schema.SCHEMATA: `Test`
475 // but information_schema.TABLES gives `test`
476 // bug #1436171
477 // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408
478 $tables = PMA_getTableList($db['name'], $tables_full[strtolower($db['name'])]);
479 } else {
480 $tables = PMA_getTableList($db['name']);
482 $child_visible =
483 (bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
484 PMA_displayTableList($tables, $child_visible, '', $db['name']);
485 } elseif ($GLOBALS['cfg']['LeftFrameLight']) {
486 // no tables and LeftFrameLight:
487 // display message no tables in selected db
488 echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
490 echo '</li>' . "\n";
491 } // end foreach db
492 } // end foreach group
494 if ($close_db_group) {
495 $url_dbgroup = '';
496 echo '</ul>';
497 echo '</li>';
498 $close_db_group = false;
501 echo '</ul>' . "\n";
505 * display unordered list of tables
506 * calls itself recursively if table in given list
507 * is a list itself
509 * @uses is_array()
510 * @uses count()
511 * @uses urlencode()
512 * @uses strpos()
513 * @uses printf()
514 * @uses htmlspecialchars()
515 * @uses strlen()
516 * @uses is_array()
517 * @uses PMA_displayTableList()
518 * @uses $_REQUEST['tbl_group']
519 * @uses $GLOBALS['common_url_query']
520 * @uses $GLOBALS['table']
521 * @uses $GLOBALS['pmaThemeImage']
522 * @uses $GLOBALS['cfg']['LeftFrameTableSeparator']
523 * @uses $GLOBALS['cfg']['DefaultTabDatabase']
524 * @uses $GLOBALS['cfg']['DefaultTabTable']
525 * @uses $GLOBALS['strRows']
526 * @uses $GLOBALS['strBrowse']
527 * @global integer the element counter
528 * @global string html code for '-' image
529 * @global string html code for '+' image
530 * @global string html code for self link
531 * @param array $tables array of tables/tablegroups
532 * @param boolean $visible whether the list is visible or not
533 * @param string $tab_group_full full tab group name
534 * @param string $table_db db of this table
536 function PMA_displayTableList($tables, $visible = false,
537 $tab_group_full = '', $table_db = '')
539 if (! is_array($tables) || count($tables) === 0) {
540 return;
543 global $element_counter, $img_minus, $img_plus, $href_left;
544 $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
546 if ($visible) {
547 echo '<ul id="subel' . $element_counter . '">';
548 } else {
549 echo '<ul id="subel' . $element_counter . '" style="display: none">';
551 foreach ($tables as $group => $table) {
552 if (isset($table['is' . $sep . 'group'])) {
553 $common_url_query = $GLOBALS['common_url_query']
554 . '&amp;tbl_group=' . urlencode($tab_group_full . $group);
556 $element_counter++;
557 echo '<li>' . "\n";
558 if ($visible
559 && ((isset($_REQUEST['tbl_group'])
560 && (strpos($_REQUEST['tbl_group'], $group) === 0
561 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
562 || strpos($GLOBALS['table'], $group) === 0)) {
563 printf($href_left, $element_counter,
564 $GLOBALS['common_url_query'] . '&amp;tbl_group=' . $tab_group_full);
565 printf($img_minus, $element_counter);
566 } else {
567 printf($href_left, $element_counter, $common_url_query);
568 printf($img_plus, $element_counter);
570 echo '</a>';
572 <a href="index.php?<?php echo $common_url_query; ?>"
573 target="_parent"
574 onclick="
575 if (! toggle('<?php echo $element_counter; ?>', true))
576 window.parent.goTo('./navigation.php?<?php echo $common_url_query; ?>');
577 window.parent.goTo('./<?php echo $GLOBALS['cfg']['DefaultTabDatabase']
578 . '?' . $common_url_query; ?>', 'main');
579 return false;">
580 <?php
581 if ($GLOBALS['text_dir'] === 'rtl') {
582 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
584 echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
585 if ($GLOBALS['text_dir'] === 'ltr') {
586 echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
589 </a>
590 <?php
592 unset($table['is' . $sep . 'group']);
593 unset($table['tab' . $sep . 'group']);
594 unset($table['tab' . $sep . 'count']);
596 if ($visible &&
597 ((isset($_REQUEST['tbl_group'])
598 && (strpos($_REQUEST['tbl_group'], $group) === 0
599 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false))
600 || strpos($GLOBALS['table'], $group) === 0)) {
601 PMA_displayTableList($table, true,
602 $tab_group_full . $group, $table_db);
603 } else {
604 PMA_displayTableList($table, false, '', $table_db);
606 echo '</li>' . "\n";
607 } elseif (is_array($table)) {
608 // quick access icon next to each table name
609 echo '<li>' . "\n";
610 echo '<a title="'
611 . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']))
612 . ': ' . htmlspecialchars($table['Comment'])
613 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows'] . ')"'
614 .' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
615 .' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
616 . $GLOBALS['common_url_query']
617 .'&amp;table=' . urlencode($table['Name'])
618 .'&amp;goto=' . $GLOBALS['cfg']['LeftDefaultTabTable']
619 . '" >'
620 .'<img class="icon"';
621 if ('VIEW' === strtoupper($table['Comment'])) {
622 echo ' src="' . $GLOBALS['pmaThemeImage'] . 's_views.png"';
623 } else {
624 echo ' src="' . $GLOBALS['pmaThemeImage'] . 'b_sbrowse.png"';
626 echo ' id="icon_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"'
627 .' width="10" height="10" alt="' . $GLOBALS['strBrowse'] . '" /></a>' . "\n";
629 // link for the table name itself
630 $href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
631 .$GLOBALS['common_url_query'] . '&amp;table='
632 .urlencode($table['Name']) . '&amp;pos=0';
633 echo '<a href="' . $href
634 . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment']
635 .' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows']) . ')"'
636 .' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">'
637 // preserve spaces in table name
638 . str_replace(' ', '&nbsp;', htmlspecialchars($table['disp_name'])) . '</a>';
639 echo '</li>' . "\n";
642 echo '</ul>';
646 * get the action word corresponding to a script name
647 * in order to display it as a title in navigation panel
649 * @uses switch()
650 * @uses $GLOBALS
651 * @param string a valid value for $cfg['LeftDefaultTabTable']
652 * or $cfg['DefaultTabTable']
654 function PMA_getTitleForTarget($target) {
655 switch ($target) {
656 case 'tbl_structure.php':
657 $message = 'strStructure';
658 break;
659 case 'tbl_sql.php':
660 $message = 'strSQL';
661 break;
662 case 'tbl_select.php':
663 $message = 'strSearch';
664 break;
665 case 'tbl_change.php':
666 $message = 'strInsert';
667 break;
668 case 'sql.php':
669 $message = 'strBrowse';
670 break;
671 default:
672 $message = '';
674 return $GLOBALS[$message];
677 echo '</div>' . "\n";
679 PMA_exitNavigationFrame();