3 // vim: expandtab sw=4 ts=4 sts=4:
6 * Gets the variables sent to this script, retains the db name that may have
7 * been defined as startup option and include a core library
9 require_once('./libraries/grab_globals.lib.php');
16 * Gets a core script and starts output buffering work
18 require_once('./libraries/common.lib.php');
19 require_once('./libraries/bookmark.lib.php');
20 require_once('./libraries/ob.lib.php');
22 $ob_mode = PMA_outBufferModeGet();
24 PMA_outBufferPre($ob_mode);
28 // garvin: For re-usability, moved http-headers
29 // to a seperate file. It can now be included by header.inc.php,
30 // queryframe.php, querywindow.php.
32 require_once('./libraries/header_http.inc.php');
37 // Gets the font sizes to use
43 require_once('./libraries/relation.lib.php');
44 $cfgRelation = PMA_getRelationsParam();
45 echo "<?xml version=\"1.0\" encoding=\"" . $GLOBALS['charset'] . "\"?".">"; // remove vertical scroll bar bug in ie
47 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
48 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
49 <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; ?>">
52 <title
>phpMyAdmin
</title
>
53 <meta http
-equiv
="Content-Type" content
="text/html; charset=<?php echo $charset; ?>" />
54 <base
<?php
if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?
> />
55 <link rel
="stylesheet" type
="text/css" href
="./css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&js_frame=left&num_dbs=0" />
57 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
59 <script type
="text/javascript" language
="javascript">
63 function open_querywindow(url
) {
65 if (!querywindow
.closed
&& querywindow
.location
) {
68 querywindow
=window
.open(url +
'&db=' + document
.queryframeform
.db
.value +
'&table=' + document
.queryframeform
.table
.value
, '','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width=<?php echo $cfg['QueryWindowWidth
']; ?>,height=<?php echo $cfg['QueryWindowHeight
']; ?>');
71 if (!querywindow
.opener
) {
72 querywindow
.opener
= blank
;
83 * function resizeRowsLeft()
84 * added 2004-07-20 by Michael Keck <mail@michaelkeck.de>
85 * - this function checks the complete frameset of
86 * index.php (parent.frames)
87 * - gets the offsetHeight of qfcontainer
88 * - sets a new frameset.rows - definition for the
89 * frameset 'leftFrameset' in 'index.php' dynamic.
90 * this script was tested on
91 * IE 6, Opera 7.53, Netsacpe 7.1 and Firefox 0.9
92 * and should work on all other DOM-Browsers and old IE-Browsers.
93 * It will never work on Netscape smaller Version 6 and IE smaller Version 4.
94 * Please give me feedback if any browser doesn't work with this script
95 * mailto:mail@michaelkeck.de?subject=resizeFrames - Browser: [the browser]
98 function resizeRowsLeft() {
99 if (document
.getElementById('qfcontainer')) { // dom browsers
100 // get the height of the div-element 'qfcontainer'
101 // we must add 10 (px) for framespacing
102 newHeight
= document
.getElementById('qfcontainer').offsetHeight+
10;
103 // check if the frameset exists
104 // please see index.php and check the frameset-definitions
105 if (parent
.document
.getElementById('mainFrameset') && parent
.document
.getElementById('leftFrameset')) {
106 parent
.document
.getElementById('leftFrameset').rows
=newHeight+
',*';
109 if (document
.all
) { // older ie-browsers
110 // get the height of the div-element 'qfcontainer'
111 // we must add 10 (px) for framespacing
112 newHeight
=document
.all('qfcontainer').offsetHeight+
10;
113 // check if the frameset exists
114 // please see index.php and check the frameset-definitions
115 if (parent
.leftFrameset
) {
116 parent
.leftFrameset
.rows
=newHeight+
',*';
125 // setup the onload handler for resizing frames
126 $js_frame_onload=' onload="resizeRowsLeft();"';
128 if ($cfg['QueryFrame']) {
130 <script type
="text/javascript" language
="javascript">
132 // added 2004-09-16 by Michael Keck (mkkeck)
134 // drop-down databases list keep focus on database change
135 // modified 2004-11-06: bug #1046434 (Light mode does not work)
136 var focus_removed
= false;
137 function remove_focus_select() {
138 focus_removed
= false;
141 function set_focus_to_nav() {
142 if (typeof(parent
.frames
.nav
)!='undefined' && focus_removed
!=true) {
143 parent
.frames
.nav
.focus();
147 setTimeout("set_focus_to_nav();",500);
157 <body id
="body_queryFrame" bgcolor
="<?php echo $cfg['LeftBgColor']; ?>"<?php
echo ((isset($js_frame_onload) && $js_frame_onload!='') ?
$js_frame_onload : ''); ?
>>
158 <div id
="qfcontainer">
160 if ($cfg['LeftDisplayLogo']) {
162 <!-- phpMyAdmin logo
-->
164 if (@file_exists
($pmaThemeImage . 'logo_left.png')) {
168 <a href
="http://www.phpmyadmin.net" target
="_blank"><img src
="<?php echo '' . $pmaThemeImage . 'logo_left.png'; ?>" alt
="phpMyAdmin" vspace
="3" border
="0" /></a
>
173 . '<div align="center"><a href="http://www.phpmyadmin.net" target="_blank">'
174 . '<img src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo2.png' .'" alt="phpMyAdmin" border="0" />'
175 . '</a></div>' . "\n";
177 echo '<hr id="hr_first" />';
178 } // end of display logo
180 if ($cfg['MainPageIconic']) {
181 $str_spacer_links='';
183 $str_spacer_links=' - ';
186 <!-- Link to the welcome page
-->
189 echo '<a class="item" href="main.php?' . PMA_generate_common_url() . '" target="phpmain' . $hash . '">'
190 . ($cfg['MainPageIconic']
191 ?
'<img src="' . $pmaThemeImage . 'b_home.png" width="16" height="16" border="0" hspace="2" alt="' . $strHome . '" title="' . $strHome . '"'
192 .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />'
193 : '<b>' . $strHome . '</b>')
195 // if we have chosen server
197 // Logout for advanced authentication
198 if ($cfg['Server']['auth_type'] != 'config') {
199 echo $str_spacer_links;
200 echo '<a class="item" href="index.php?' . PMA_generate_common_url() . '&old_usr=' . urlencode($PHP_AUTH_USER) . '" target="_parent">'
201 . ($cfg['MainPageIconic']
202 ?
'<img src="' . $pmaThemeImage . 's_loggoff.png" width="16" height="16" border="0" hspace="2" alt="' . $strLogout . '" title="' . $strLogout . '"'
203 .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />'
204 : '<b>' . $strLogout . '</b>')
208 $anchor = 'querywindow.php?' . PMA_generate_common_url('', '');
209 if ($cfg['QueryFrameJS']) {
212 $onclick = 'onclick="javascript:open_querywindow(this.href); return false;"';
215 $target = 'target="phpmain' . $hash . '"';
218 if ($cfg['MainPageIconic']) {
219 $query_frame_link_text = '<img src="' . $pmaThemeImage . 'b_selboard.png" border="0" hspace="1" width="16" height="16" alt="' . $strQueryFrame . '" title="' . $strQueryFrame . '"'
220 .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />';
222 echo ($str_spacer_links != '' ?
'<br />' : '');
223 $query_frame_link_text = '<b>' . $strQueryFrame . '</b>';
226 <script type
="text/javascript">
228 document
.writeln('<a href="<?php echo $href; ?>" <?php echo $target . ' ' . $onclick; ?> class="item"><?php echo addslashes($query_frame_link_text); ?><\/a>');
232 <a href
="<?php echo $href; ?>&no_js=true" <?php
echo $target . ' ' . $onclick; ?
> target
="phpmain<?php echo $hash; ?>" class="item"><?php
echo $query_frame_link_text; ?
></a
>
237 if ($cfg['MainPageIconic']) {
238 echo '<img src="' .$GLOBALS['pmaThemeImage'] . 'spacer.png' .'" width="2" height="1" border="0" alt="" />'
239 . '<a href="Documentation.html" target="documentation" class="item">'
240 . '<img src="' . $pmaThemeImage . 'b_docs.png" border="0" hspace="1" width="16" height="16" alt="' . $strPmaDocumentation . '" title="' . $strPmaDocumentation . '"'
241 . ' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />'
244 . '<a href="' . $cfg['MySQLManualBase'] . '" target="documentation" class="item">'
245 . '<img src="' . $pmaThemeImage . 'b_sqlhelp.png" border="0" hspace="1" width="16" height="16" alt="MySQL - ' . $strDocu . '" title="MySQL - ' . $strDocu . '"'
246 .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />'
252 <hr id
="hr_second" />
255 if ($cfg['LeftDisplayServers']){
256 $show_server_left = TRUE;
257 include('./libraries/select_server.lib.php');
258 } // end if LeftDisplayServers
260 <!-- Databases
list -->
263 * Get the list and number of available databases.
264 * Skipped if no server selected: in this case no database should be displayed
265 * before the user choose among available ones at the welcome screen.
268 PMA_availableDatabases(); // this function is defined in "common.lib.php"
273 // Don't display expansible/collapsible database info if:
274 // 1. $server == 0 (no server selected)
275 // This is the case when there are multiple servers and
276 // '$cfg['ServerDefault'] = 0' is set. In that case, we want the welcome
277 // screen to appear with no database info displayed.
278 // 2. there is only one database available (ie either only one database exists
279 // or $cfg['Servers']['only_db'] is defined and is not an array)
280 // In this case, the database should not be collapsible/expandable
282 // Light mode -> beginning of the select combo for databases
283 // Note: When javascript is active, the frameset will be changed from
284 // within left.php. With no JS (<noscript>) the whole frameset will
285 // be rebuilt with the new target frame.
286 if ($cfg['LeftFrameLight']) {
288 <table border
="0" cellpadding
="1" cellspacing
="0">
290 <td align
="left" class="heada"><?php
echo $strDatabase; ?
>:</td
>
294 <form method
="post" action
="index.php" name
="left" target
="_parent" style
="margin: 0px; padding: 0px;">
295 <script type
="text/javascript" language
="javascript">
297 document
.left
.action
="left.php";
298 document
.left
.target
="nav";
302 echo PMA_generate_common_hidden_inputs();
303 echo ' <input type="hidden" name="hash" value="' . $hash . '" />' . "\n";
305 <select name
="lightm_db" onchange
="remove_focus_select();this.form.submit();">
307 echo ' <option value="">(' . $strDatabases . ') ...</option>' . "\n";
309 $table_list_header = '';
313 // natural order for db list; but do not sort if user asked
314 // for a specific order with the 'only_db' mechanism
316 // TODO: merge this logic with the one in left.php
318 if (!is_array($cfg['Server']['only_db']) && $cfg['NaturalOrder'] && $num_dbs > 0) {
319 $dblist_temp = $dblist;
320 natsort($dblist_temp);
322 foreach ($dblist_temp as $each) {
328 // Gets the tables list per database
329 for ($i = 0; $i < $num_dbs; $i++
) {
332 if (!empty($db_start) && $db == $db_start) {
335 $tables = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE
);
336 $num_tables = ($tables) ? @PMA_DBI_num_rows
($tables) : 0;
337 $common_url_query = PMA_generate_common_url($db);
339 $num_tables_disp = $num_tables;
341 $num_tables_disp = '-';
343 // Get additional information about tables for tooltip
344 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION
>= 32303
346 && (!$cfg['LeftFrameLight'] ||
$selected_db == $j)) {
348 $tooltip_name = array();
349 $result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
350 while ($tmp = PMA_DBI_fetch_assoc($result)) {
351 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '');
352 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] && $cfg['ShowTooltipAliasTB'] !== 'nested' ?
$tmp['Name'] : $tmp['Comment']);
353 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ?
$tmp['Comment'] . ' ' : '')
354 . '(' . (isset($tmp['Rows']) ?
$tmp['Rows'] : '0') . ' ' . $strRows . ')';
358 // garvin: Get comments from PMA comments table
360 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
361 $tmp_db_tooltip = PMA_getComments($db);
362 if (is_array($tmp_db_tooltip)) {
363 $db_tooltip = implode(' ', $tmp_db_tooltip);
367 // Builds the databases' names list
368 if (!empty($db_start) && $db == $db_start) {
369 $table_title = array();
370 $table_array = array();
371 // Gets the list of tables from the current database
372 while (list($table) = PMA_DBI_fetch_row($tables)) {
373 $table_array[$table] = '';
374 $url_title = (!empty($tooltip) && isset($tooltip[$table]))
375 ?
htmlspecialchars($tooltip[$table])
377 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
378 ?
htmlspecialchars($tooltip_name[$table])
380 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
381 } // end while (tables list)
382 $selected = ' selected="selected"';
385 } // end if... else...
387 if (!empty($num_tables)) {
389 . '<option value="' . htmlspecialchars($db) . '"' . $selected . '>'
390 . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (' . $num_tables . ')</option>' . "\n";
393 . '<option value="' . htmlspecialchars($db) . '"' . $selected . '>'
394 . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ?
htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (-)</option>' . "\n";
395 } // end if... else...
397 } // end for $i (db list)
401 <input type
="submit" name
="Go" value
="<?php echo $strGo; ?>" />
409 } // end if LeftFrameLight
410 } // end if num_db > 1
412 <form name
="queryframeform" action
="queryframe.php" method
="get" style
="margin:0px; padding:0px; display:none;">
413 <input type
="hidden" name
="db" value
="" />
414 <input type
="hidden" name
="table" value
="" />
415 <input type
="hidden" name
="framename" value
="queryframe" />
417 <form name
="hashform" action
="queryframe.php" style
="margin:0px; padding:0px; display:none;">
418 <input type
="hidden" name
="hash" value
="<?php echo $hash; ?>" />
426 * Close MySql connections
428 if (isset($dbh) && $dbh) {
429 @PMA_DBI_close
($dbh);
431 if (isset($userlink) && $userlink) {
432 @PMA_DBI_close
($userlink);
437 * Sends bufferized data
439 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
440 && isset($ob_mode) && $ob_mode) {
441 PMA_outBufferPost($ob_mode);