(it) Updates
[phpmyadmin/crack.git] / left.php3
bloba6c7ea1104d6e5a8c11bdd5018cb5191c362390d
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Gets the variables sent to this script, retains the db name that may have
8 * been defined as startup option and include a core library
9 */
10 require('./libraries/grab_globals.lib.php3');
11 if (!empty($db)) {
12 $db_start = $db;
16 /**
17 * Gets a core script and starts output buffering work
19 require('./libraries/common.lib.php3');
20 require('./libraries/ob.lib.php3');
21 if ($cfg['OBGzip']) {
22 $ob_mode = PMA_outBufferModeGet();
23 if ($ob_mode) {
24 PMA_outBufferPre($ob_mode);
29 /**
30 * Get the list and number of available databases.
31 * Skipped if no server selected: in this case no database should be displayed
32 * before the user choose among available ones at the welcome screen.
34 if ($server > 0) {
35 PMA_availableDatabases(); // this function is defined in "common.lib.php3"
36 } else {
37 $num_dbs = 0;
41 /**
42 * Send http headers
44 // Don't use cache (required for Opera)
45 $now = gmdate('D, d M Y H:i:s') . ' GMT';
46 header('Expires: ' . $now);
47 header('Last-Modified: ' . $now);
48 header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
49 header('Pragma: no-cache'); // HTTP/1.0
50 // Define the charset to be used
51 header('Content-Type: text/html; charset=' . $charset);
54 /**
55 * Displays the frame
57 // Gets the font sizes to use
58 PMA_setFontSizes();
60 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
61 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
62 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>">
64 <head>
65 <title>phpMyAdmin</title>
66 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
67 <base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> target="phpmain" />
68 <?php
69 // Expandable/collapsible databases list is only used if there is more than one
70 // database to display
71 if ($num_dbs > 1 && !$cfg['LeftFrameLight']) {
72 echo "\n";
74 <!-- Collapsible tables list scripts -->
75 <script type="text/javascript" language="javascript">
76 <!--
77 var isDOM = (typeof(document.getElementsByTagName) != 'undefined'
78 && typeof(document.createElement) != 'undefined')
79 ? 1 : 0;
80 var isIE4 = (typeof(document.all) != 'undefined'
81 && parseInt(navigator.appVersion) >= 4)
82 ? 1 : 0;
83 var isNS4 = (typeof(document.layers) != 'undefined')
84 ? 1 : 0;
85 var capable = (isDOM || isIE4 || isNS4)
86 ? 1 : 0;
87 // Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant
88 if (capable) {
89 if (typeof(window.opera) != 'undefined') {
90 capable = 0;
92 else if (typeof(navigator.userAgent) != 'undefined') {
93 var browserName = ' ' + navigator.userAgent.toLowerCase();
94 if (browserName.indexOf('konqueror') > 0) {
95 capable = 0;
97 } // end if... else if...
98 } // end if
99 var fontFamily = '<?php echo $left_font_family; ?>';
100 var fontSize = '<?php echo $font_size; ?>';
101 var fontBig = '<?php echo $font_bigger; ?>';
102 var fontSmall = '<?php echo $font_smaller; ?>';
103 var isServer = <?php echo ($server > 0) ? 'true' : 'false'; ?>;
104 //-->
105 </script>
106 <script src="libraries/left.js" type="text/javascript" language="javascript1.2"></script>
107 <noscript>
108 <style type="text/css">
109 <!--
110 div {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
111 .heada {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
112 .headaCnt {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_smaller; ?>; color: #000000}
113 .parent {font-family: <?php echo $left_font_family; ?>; color: #000000; text-decoration: none}
114 .child {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_smaller; ?>; color: #333399; text-decoration: none}
115 .item, .item:active, .item:hover, .tblItem, .tblItem:active {color: #333399; text-decoration: none}
116 .tblItem:hover {color: #FF0000; text-decoration: underline}
117 //-->
118 </style>
119 </noscript>
121 <style type="text/css">
122 <!--
123 body {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>}
124 //-->
125 </style>
126 <?php
127 } // end if ($num_dbs > 1)
129 else if ($num_dbs == 1) {
130 echo "\n";
132 <style type="text/css">
133 <!--
134 body {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>}
135 div {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
136 .heada {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
137 .headaCnt {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_smaller; ?>; color: #000000}
138 .parent {font-family: <?php echo $left_font_family; ?>; color: #000000; text-decoration: none}
139 .child {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_smaller; ?>; color: #333399; text-decoration: none}
140 .item, .item:active, .item:hover, .tblItem, .tblItem:active {font-size: <?php echo $font_smaller; ?>; color: #333399; text-decoration: none}
141 .tblItem:hover {color: #FF0000; text-decoration: underline}
142 //-->
143 </style>
144 <?php
145 } // end if ($num_dbs == 1)
147 else {
148 echo "\n";
150 <style type="text/css">
151 <!--
152 body {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>}
153 div {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
154 input {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>}
155 select {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; background-color: #ffffff; color: #000000}
156 .heada {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
157 .parent {font-family: <?php echo $left_font_family; ?>; color: #000000; text-decoration: none}
158 .item, .item:active, .item:hover, .tblItem, .tblItem:active {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_smaller; ?>; color: #333399; text-decoration: none}
159 .tblItem:hover {color: #FF0000; text-decoration: underline}
160 //-->
161 </style>
162 <?php
163 } // end if ($num_dbs < 1)
165 echo "\n";
167 </head>
169 <body bgcolor="<?php echo $cfg['LeftBgColor']; ?>">
171 <?php
172 if ($cfg['LeftDisplayLogo']) {
174 <!-- phpMyAdmin logo -->
175 <a href="http://www.phpmyadmin.net" target="_blank"><img src="./images/pma_logo.png" width="88" height="31" border="0" alt="phpMyAdmin" /></a>
176 <?php
178 echo "\n";
180 <!-- Link to the welcome page -->
181 <div id="el1Parent" class="parent" style="margin-bottom: 5px">
182 <nobr><a class="item" href="main.php3?<?php echo PMA_generate_common_url(); ?>"><span class="heada"><b><?php echo $strHome; ?></b></span></a></nobr>
183 </div>
186 <!-- Databases and tables list -->
187 <?php
188 // Don't display expansible/collapsible database info if:
189 // 1. $server == 0 (no server selected)
190 // This is the case when there are multiple servers and
191 // '$cfg['ServerDefault'] = 0' is set. In that case, we want the welcome
192 // screen to appear with no database info displayed.
193 // 2. there is only one database available (ie either only one database exists
194 // or $cfg['Servers']['only_db'] is defined and is not an array)
195 // In this case, the database should not be collapsible/expandable
196 if ($num_dbs > 1) {
198 // Light mode -> beginning of the select combo for databases
199 if ($cfg['LeftFrameLight']) {
200 echo ' <form method="post" action="index.php3" name="left" target="_parent">' . "\n";
201 echo PMA_generate_common_hidden_inputs();
202 echo ' <select name="lightm_db" onchange="this.form.submit()">' . "\n";
203 echo ' <option value="">(' . $strDatabases . ') ...</option>' . "\n";
204 $table_list = '';
205 $table_list_header = '';
206 $db_name = '';
209 $selected_db = 0;
211 // Gets the tables list per database
212 for ($i = 0; $i < $num_dbs; $i++) {
213 $db = $dblist[$i];
214 $j = $i + 2;
215 if (!empty($db_start) && $db == $db_start) {
216 $selected_db = $j;
218 $tables = @PMA_mysql_list_tables($db);
219 $num_tables = ($tables) ? @mysql_numrows($tables) : 0;
220 $common_url_query = PMA_generate_common_url($db);
221 if ($num_tables) {
222 $num_tables_disp = $num_tables;
223 } else {
224 $num_tables_disp = '-';
227 // Get additional infomation about tables for tooltip
228 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303
229 && $num_tables
230 && (!$cfg['LeftFrameLight'] || $selected_db == $j)) {
231 $tooltip = array();
232 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
233 while ($tmp = PMA_mysql_fetch_array($result)) {
234 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '')
235 . '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')';
236 } // end while
237 } // end if
239 // No light mode -> displays the expandible/collapsible db list
240 if ($cfg['LeftFrameLight'] == FALSE) {
242 // Displays the database name
243 $on_mouse = (($cfg['LeftPointerColor'] == '') ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftBgColor'] . '\')}"');
245 echo "\n";
246 echo ' <div id="el' . $j . 'Parent" class="parent"' . $on_mouse . '>';
248 if (!empty($num_tables)) {
249 echo "\n";
251 <nobr><a class="item" href="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>" onclick="if (capable) {expandBase('el<?php echo $j; ?>', true); return false} else {return true}">
252 <img name="imEx" id="el<?php echo $j; ?>Img" src="images/plus.png" border="0" width="9" height="9" alt="+" /></a>
253 <?php
254 } else {
255 echo "\n";
257 <nobr><img name="imEx" src="images/minus.png" border="0" width="9" height="9" alt="-" />
258 <?php
260 echo "\n";
262 <a class="item" href="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>" onclick="if (capable) {expandBase('el<?php echo $j; ?>', false)}">
263 <span class="heada"><?php echo htmlspecialchars($db); ?><bdo dir="<?php echo($text_dir); ?>">&nbsp;&nbsp;</bdo></span><span class="headaCnt">(<?php echo $num_tables_disp; ?>)</span></a></nobr>
264 </div>
266 <div id="el<?php echo $j;?>Child" class="child" style="margin-bottom: 5px"<?php echo $on_mouse; ?>>
268 <?php
269 // Displays the list of tables from the current database
270 for ($t = 0; $t < $num_tables; $t++) {
271 $table = PMA_mysql_tablename($tables, $t);
272 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
273 ? htmlspecialchars($tooltip[$table])
274 : '';
275 echo "\n";
277 <nobr><img src="images/spacer.gif" border="0" width="9" height="9" alt="" />
278 <a target="phpmain" href="sql.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table)); ?>&amp;pos=0&amp;goto=<?php echo $cfg['DefaultTabTable']; ?>" title="<?php echo $strBrowse . ': ' . htmlspecialchars($table); ?>">
279 <img src="images/browse.png" width="8" height="8" border="0" alt="<?php echo $strBrowse . ': ' . htmlspecialchars($table); ?>" /></a><bdo dir="<?php echo $text_dir; ?>">&nbsp;</bdo>
280 <a class="tblItem" id="tbl_<?php echo md5($table); ?>" title="<?php echo $url_title; ?>" target="phpmain" href="<?php echo $cfg['DefaultTabTable']; ?>?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>">
281 <?php echo htmlspecialchars($table); ?></a></nobr><br />
282 <?php
283 } // end for $t (tables list)
284 echo "\n";
286 </div>
287 <?php
288 echo "\n";
292 // Light mode -> displays the select combo with databases names and the
293 // list of tables contained in the current database
294 else {
295 echo "\n";
297 // Builds the databases' names list
298 if (!empty($db_start) && $db == $db_start) {
299 // Gets the list of tables from the current database
300 for ($t = 0; $t < $num_tables; $t++) {
301 $table = PMA_mysql_tablename($tables, $t);
302 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
303 ? str_replace('"', '&quot;', $tooltip[$table])
304 : '';
305 $table_list .= ' <nobr><a target="phpmain" href="sql.php3?' . $common_url_query . '&amp;table=' . urlencode($table) . '&amp;sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($table)) . '&amp;pos=0&amp;goto=' . $cfg['DefaultTabTable'] . '">' . "\n";
306 $table_list .= ' <img src="images/browse.png" width="8" height="8" border="0" alt="' . $strBrowse . ': ' . $table . '" title="' . $strBrowse . ': ' . htmlspecialchars($table) . '" /></a><bdo dir="' . $text_dir . '">&nbsp;</bdo>' . "\n";
307 if (PMA_USR_BROWSER_AGENT == 'IE') {
308 $table_list .= ' <span class="tblItem"><a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table) . '">' . htmlspecialchars($table) . '</a></span></nobr><br />' . "\n";
309 } else {
310 $table_list .= ' <a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table) . '">' . htmlspecialchars($table) . '</a></nobr><br />' . "\n";
312 } // end for $t (tables list)
314 if (!$table_list) {
315 $table_list = ' <br /><br />' . "\n"
316 . ' <div>' . $strNoTablesFound . '</div>' . "\n";
318 $selected = ' selected="selected"';
320 $table_list_header .= ' <a class="item" target="phpmain" href="' . $cfg['DefaultTabDatabase'] . '?' . $common_url_query . '">' . "\n";
321 $table_list_header .= ' <span class="heada"><b>' . htmlspecialchars($db) . '</b><bdo dir="' . $text_dir . '">&nbsp;&nbsp;</bdo></span></a><br />' . "\n\n";
322 } else {
323 $selected = '';
324 } // end if... else...
326 if (!empty($num_tables)) {
327 echo ' <option value="' . urlencode($db) . '"' . $selected . '>' . htmlspecialchars($db) . ' (' . $num_tables . ')</option>' . "\n";
328 } else {
329 echo ' <option value="' . urlencode($db) . '"' . $selected . '>' . htmlspecialchars($db) . ' (-)</option>' . "\n";
330 } // end if... else...
332 } // end if (light mode)
334 } // end for $i (db list)
336 // Light mode -> end of the select combo for databases and table list for
337 // the current database
338 if ($cfg['LeftFrameLight']) {
339 echo ' </select>' . "\n";
340 echo ' <noscript><input type="submit" name="Go" value="' . $strGo . '" /></noscript>' . "\n";
341 echo ' </form>' . "\n";
343 if (!$table_list) {
344 $table_list = ' <div>' . $strSelectADb . '</div>' . "\n";
347 // Displays the current database name and the list of tables it
348 // contains
349 echo "\n" . ' <hr noshade="noshade" />' . "\n\n";
350 echo $table_list_header;
351 echo $table_list;
352 echo "\n" . ' <hr noshade="noshade" />' . "\n";
355 // No light mode -> initialize some js variables for the
356 // expandible/collapsible stuff
357 else {
360 <!-- Arrange collapsible/expandable db list at startup -->
361 <script type="text/javascript" language="javascript1.2">
362 <!--
363 if (isNS4) {
364 firstEl = 'el1Parent';
365 firstInd = nsGetIndex(firstEl);
366 nsShowAll();
367 nsArrangeList();
369 var expandedDb = '<?php echo (empty($selected_db)) ? '' : 'el' . $selected_db . 'Child'; ?>';
370 //-->
371 </script>
372 <?php
374 } // end if... else... (light mode)
376 } // end if ($server > 1)
379 // Case where only one database has to be displayed
380 else if ($num_dbs == 1) {
381 $db = $dblist[0];
382 $tables = @PMA_mysql_list_tables($db);
383 $num_tables = ($tables) ? @mysql_numrows($tables) : 0;
384 $common_url_query = PMA_generate_common_url($db);
385 if ($num_tables) {
386 $num_tables_disp = $num_tables;
387 } else {
388 $num_tables_disp = '-';
391 // Get additional infomation about tables for tooltip
392 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303
393 && $num_tables) {
394 $tooltip = array();
395 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
396 while ($tmp = PMA_mysql_fetch_array($result)) {
397 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '')
398 . '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')';
399 } // end while
400 } // end if
402 // Displays the database name
403 echo "\n";
405 <div id="el2Parent" class="parent">
406 <nobr><a class="item" href="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>">
407 <span class="heada"><?php echo htmlspecialchars($db); ?><bdo dir="<?php echo($text_dir); ?>">&nbsp;&nbsp;</bdo></span><span class="headaCnt">(<?php echo $num_tables_disp; ?>)</span></a></nobr>
408 </div>
409 <div id="el2Child" class="child" style="margin-bottom: 5px">
410 <?php
411 // Displays the list of tables from the current database
412 for ($j = 0; $j < $num_tables; $j++) {
413 $table = PMA_mysql_tablename($tables, $j);
414 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
415 ? str_replace('"', '&quot;', $tooltip[$table])
416 : '';
417 echo "\n";
419 <nobr><a target="phpmain" href="sql.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table)); ?>&amp;pos=0&amp;goto=<?php echo $cfg['DefaultTabTable']; ?>" title="<?php echo $strBrowse . ': ' . htmlspecialchars($table); ?>">
420 <img src="images/browse.png" width="8" height="8" border="0" alt="<?php echo $strBrowse . ': ' . htmlspecialchars($table); ?>" /></a><bdo dir="<?php echo $text_dir; ?>">&nbsp;</bdo>
421 <a class="tblItem" id="tbl_<?php echo md5($table); ?>" title="<?php echo $url_title; ?>" target="phpmain" href="<?php echo $cfg['DefaultTabTable']; ?>?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>">
422 <?php echo htmlspecialchars($table); ?></a></nobr><br />
423 <?php
424 } // end for $j (tables list)
425 echo "\n";
427 </div>
428 <?php
429 } // end if ($num_dbs == 1)
432 // Case where no database has to be displayed
433 else {
434 echo "\n";
435 echo '<p>' . $strNoDatabases . '</p>';
436 } // end if ($num_dbs == 0)
437 echo "\n";
440 </body>
441 </html>
443 <?php
445 * Close MySql connections
447 if (isset($dbh) && $dbh) {
448 @mysql_close($dbh);
450 if (isset($userlink) && $userlink) {
451 @mysql_close($userlink);
456 * Sends bufferized data
458 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
459 && isset($ob_mode) && $ob_mode) {
460 PMA_outBufferPost($ob_mode);