Documentation TYPO3 par Ameos

queryframe.php

00001 <?php
00002 /* $Id: queryframe.php,v 2.30.2.1 2005/10/21 01:27:32 lem9 Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00009 require_once('./libraries/grab_globals.lib.php');
00010 if (!empty($db)) {
00011     $db_start = $db;
00012 }
00013 
00014 
00018 require_once('./libraries/common.lib.php');
00019 require_once('./libraries/bookmark.lib.php');
00020 require_once('./libraries/ob.lib.php');
00021 if ($cfg['OBGzip']) {
00022     $ob_mode = PMA_outBufferModeGet();
00023     if ($ob_mode) {
00024         PMA_outBufferPre($ob_mode);
00025     }
00026 }
00027 // security fix:
00028 if (isset($hash)) {
00029    $hash = PMA_sanitize($hash);
00030 }
00031 
00032 // garvin: For re-usability, moved http-headers
00033 // to a seperate file. It can now be included by header.inc.php,
00034 // queryframe.php, querywindow.php.
00035 
00036 require_once('./libraries/header_http.inc.php');
00037 
00041 // Gets the font sizes to use
00042 PMA_setFontSizes();
00043 
00047 require_once('./libraries/relation.lib.php');
00048 $cfgRelation = PMA_getRelationsParam();
00049 echo "<?xml version=\"1.0\" encoding=\"" . $GLOBALS['charset'] . "\"?".">"; // remove vertical scroll bar bug in ie
00050 ?>
00051 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
00052     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
00053 <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; ?>">
00054 
00055 <head>
00056 <title>phpMyAdmin</title>
00057 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
00058 <base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> />
00059 <link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&amp;js_frame=left&amp;num_dbs=0" />
00060 <?php
00061 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
00062 ?>
00063 <script type="text/javascript" language="javascript">
00064 <!--
00065 var querywindow = '';
00066 
00067 function open_querywindow(url) {
00068 
00069     if (!querywindow.closed && querywindow.location) {
00070         querywindow.focus();
00071     } else {
00072         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']; ?>');
00073     }
00074 
00075     if (!querywindow.opener) {
00076         querywindow.opener = blank;
00077     }
00078 
00079     if (window.focus) {
00080         querywindow.focus();
00081     }
00082 
00083     return false;
00084 }
00085 
00102 function resizeRowsLeft() {
00103     if (document.getElementById('qfcontainer')) { // dom browsers
00104         // get the height of the div-element 'qfcontainer'
00105         // we must add 10 (px) for framespacing
00106         newHeight = document.getElementById('qfcontainer').offsetHeight+10;
00107         // check if the frameset exists
00108         // please see index.php and check the frameset-definitions
00109         if (parent.document.getElementById('mainFrameset') && parent.document.getElementById('leftFrameset')) {
00110             parent.document.getElementById('leftFrameset').rows=newHeight+',*';
00111         }
00112     } else {
00113         if (document.all) { // older ie-browsers
00114             // get the height of the div-element 'qfcontainer'
00115             // we must add 10 (px) for framespacing
00116             newHeight=document.all('qfcontainer').offsetHeight+10;
00117             // check if the frameset exists
00118             // please see index.php and check the frameset-definitions
00119             if (parent.leftFrameset) {
00120                 parent.leftFrameset.rows=newHeight+',*';
00121             }
00122         }
00123     }
00124 }
00125 
00126 //-->
00127 </script>
00128 <?php
00129     // setup the onload handler for resizing frames
00130     $js_frame_onload=' onload="resizeRowsLeft();"';
00131 }
00132 if ($cfg['QueryFrame']) {
00133 ?>
00134 <script type="text/javascript" language="javascript">
00135 <!--
00136 // added 2004-09-16 by Michael Keck (mkkeck)
00137 //                  bug: #1027321
00138 //                       drop-down databases list keep focus on database change
00139 // modified 2004-11-06: bug #1046434 (Light mode does not work)
00140 var focus_removed = false;
00141 function remove_focus_select() {
00142     focus_removed = false;
00143     set_focus_to_nav();
00144 }
00145 function set_focus_to_nav() {
00146     if (typeof(parent.frames.nav)!='undefined' && focus_removed!=true) {
00147         parent.frames.nav.focus();
00148         focus_removed=true;
00149     } else {
00150         focus_removed=false;
00151         setTimeout("set_focus_to_nav();",500);
00152     }
00153 }
00154 //-->
00155 </script>
00156 <?php
00157 }
00158 ?>
00159 </head>
00160 
00161 <body id="body_queryFrame" bgcolor="<?php echo $cfg['LeftBgColor']; ?>"<?php echo ((isset($js_frame_onload) && $js_frame_onload!='') ? $js_frame_onload : ''); ?>>
00162 <div id="qfcontainer">
00163 <div align="center">
00164 <?php
00165 if ($cfg['LeftDisplayLogo']) {
00166     echo '<!-- phpMyAdmin logo -->' . "\n";
00167     echo '    <a href="http://www.phpmyadmin.net/" target="_blank">';
00168     if (@file_exists($GLOBALS['pmaThemeImage'] . 'logo_left.png')) {
00169         echo '<img src="' . $GLOBALS['pmaThemeImage'] . 'logo_left.png" alt="phpMyAdmin" border="0" />';
00170     } else if (@file_exists($GLOBALS['pmaThemeImage'] . 'pma_logo2.png')) {
00171         echo '<img src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo2.png" alt="phpMyAdmin" border="0" />';
00172     } else {
00173         echo 'phpMyAdmin';
00174     }
00175     echo '</a>' . "\n";
00176     echo '    <hr id="hr_first" />' . "\n";
00177 } // end of display logo
00178 
00179 ?>
00180 <!-- Link to the welcome page -->
00181 <?php
00182     echo '    <a class="item" href="main.php?' . PMA_generate_common_url() . '" target="phpmain' . $hash . '">' . "\n"
00183        . ($cfg['MainPageIconic']
00184             ? '        <img src="' . $pmaThemeImage . 'b_home.png" width="16" height="16" border="0" hspace="2" alt="' . $strHome . '" title="' . $strHome . '"'
00185                     .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />'
00186             : '        <b>' . $strHome . '</b>') . "\n"
00187         . '    </a>' . "\n";
00188     // if we have chosen server
00189     if ($server != 0) {
00190         // Logout for advanced authentication
00191         if ($cfg['Server']['auth_type'] != 'config') {
00192             echo ($cfg['MainPageIconic'] ? '' : ' - ');
00193             echo '<a class="item" href="index.php?' . PMA_generate_common_url() . '&amp;old_usr=' . urlencode($PHP_AUTH_USER) . '" target="_parent">' . "\n"
00194                . ($cfg['MainPageIconic']
00195                     ? '<img src="' . $pmaThemeImage . 's_loggoff.png" width="16" height="16" border="0" hspace="2" alt="' . $strLogout . '" title="' . $strLogout . '"'
00196                             .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />'
00197                     : '<b>' . $strLogout . '</b>')  . "\n"
00198                . '</a>' . "\n";
00199         } // end if ($cfg['Server']['auth_type'] != 'config'
00200 
00201         if ($cfg['QueryFrame']) {
00202             $anchor = 'querywindow.php?' . PMA_generate_common_url('', '');
00203             
00204             if ($cfg['MainPageIconic']) {
00205                 $query_frame_link_text = '<img src="' . $pmaThemeImage . 'b_selboard.png" border="0" hspace="1" width="16" height="16" alt="' . $strQueryFrame . '" title="' . $strQueryFrame . '"'
00206                                        .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />';
00207             } else {
00208                 echo '<br />' . "\n";
00209                 $query_frame_link_text = '<b>' . $strQueryFrame . '</b>';
00210             }
00211 ?>
00212     <a href="<?php echo $anchor; ?>&amp;no_js=true" target="phpmain<?php echo $hash; ?>" class="item"
00213        <?php echo ($cfg['QueryFrameJS'] ? 'onclick="javascript:open_querywindow(\'' . $anchor . '\'); return false;"' : ''); ?>>
00214         <?php echo $query_frame_link_text; ?>
00215     </a>
00216 <?php
00217         } // end if ($cfg['QueryFrame'])
00218     } // end if ($server != 0)
00219 
00220 if ($cfg['MainPageIconic']) {
00221     echo '    <a href="Documentation.html" target="documentation" class="item">' . "\n"
00222        . '        <img src="' . $pmaThemeImage . 'b_docs.png" border="0" hspace="1" width="16" height="16" alt="' . $strPmaDocumentation . '" title="' . $strPmaDocumentation . '"'
00223        . ' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />' . "\n"
00224        . '    </a>' . "\n";
00225     echo '    <a href="' . $cfg['MySQLManualBase'] . '" target="documentation" class="item">' . "\n"
00226        . '        <img src="' . $pmaThemeImage . 'b_sqlhelp.png" border="0" hspace="1" width="16" height="16" alt="MySQL - ' . $strDocu . '" title="MySQL - ' . $strDocu . '"'
00227        .' onmouseover="this.style.backgroundColor=\'#ffffff\';" onmouseout="this.style.backgroundColor=\'\';" align="middle" />' . "\n"
00228        . '    </a>' . "\n";
00229 }
00230 ?>
00231 </div>
00232 <hr id="hr_second" />
00233 
00234 <?php
00235 if ($cfg['LeftDisplayServers']){
00236     $show_server_left = TRUE;
00237     include('./libraries/select_server.lib.php');
00238 } // end if LeftDisplayServers
00239 ?>
00240 <!-- Databases list -->
00241 <?php
00247 if ($server > 0) {
00248     PMA_availableDatabases(); // this function is defined in "common.lib.php"
00249 } else {
00250     $num_dbs = 0;
00251 }
00252 
00253 // Don't display expansible/collapsible database info if:
00254 // 1. $server == 0 (no server selected)
00255 //    This is the case when there are multiple servers and
00256 //    '$cfg['ServerDefault'] = 0' is set. In that case, we want the welcome
00257 //    screen to appear with no database info displayed.
00258 // 2. there is only one database available (ie either only one database exists
00259 //    or $cfg['Servers']['only_db'] is defined and is not an array)
00260 //    In this case, the database should not be collapsible/expandable
00261 if ($num_dbs > 1) {
00262     // Light mode -> beginning of the select combo for databases
00263     // Note: When javascript is active, the frameset will be changed from
00264     // within left.php. With no JS (<noscript>) the whole frameset will
00265     // be rebuilt with the new target frame.
00266     if ($cfg['LeftFrameLight']) {
00267     ?>
00268     <table border="0" cellpadding="1" cellspacing="0">
00269         <tr>
00270             <td align="left" class="heada"><?php echo $strDatabase; ?>:</td>
00271         </tr>
00272         <tr>
00273             <td nowrap="nowrap">
00274     <form method="post" action="index.php" name="left" target="_parent" style="margin: 0px; padding: 0px;">
00275     <script type="text/javascript" language="javascript">
00276     <!--
00277         document.left.action="left.php";
00278         document.left.target="nav";
00279     //-->
00280     </script>
00281     <?php
00282         echo PMA_generate_common_hidden_inputs();
00283         echo '        <input type="hidden" name="hash" value="' . $hash . '" />' . "\n";
00284         ?>
00285         <select name="lightm_db" onchange="remove_focus_select();this.form.submit();">
00286         <?php
00287         echo '            <option value="">(' . $strDatabases . ') ...</option>' . "\n";
00288         $table_list = '';
00289         $table_list_header = '';
00290         $db_name    = '';
00291         $selected_db = 0;
00292 
00293         // natural order for db list; but do not sort if user asked
00294         // for a specific order with the 'only_db' mechanism
00295 
00296         // TODO: merge this logic with the one in left.php
00297 
00298         if (!is_array($cfg['Server']['only_db']) && $cfg['NaturalOrder'] && $num_dbs > 0) {
00299             $dblist_temp = $dblist;
00300             natsort($dblist_temp);
00301             $i = 0;
00302             foreach ($dblist_temp as $each) {
00303                 $dblist[$i] = $each;
00304                 $i++;
00305             }
00306         }
00307         $parent = '';
00308         // Gets the tables list per database
00309         for ($i = 0; $i < $num_dbs; $i++) {
00310             $db = $dblist[$i];
00311             $j  = $i + 2;
00312             if (!empty($db_start) && $db == $db_start) {
00313                 $selected_db = $j;
00314             }
00315             $tables              = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
00316             $num_tables          = ($tables) ? @PMA_DBI_num_rows($tables) : 0;
00317             $common_url_query    = PMA_generate_common_url($db);
00318             if ($num_tables) {
00319                 $num_tables_disp = $num_tables;
00320             } else {
00321                 $num_tables_disp = '-';
00322             }
00323             // Get additional information about tables for tooltip
00324             if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303
00325                 && $num_tables
00326                 && (!$cfg['LeftFrameLight'] || $selected_db == $j)) {
00327                 $tooltip = array();
00328                 $tooltip_name = array();
00329                 $result  = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
00330                 while ($tmp = PMA_DBI_fetch_assoc($result)) {
00331                     $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '');
00332                     $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] && $cfg['ShowTooltipAliasTB'] !== 'nested' ? $tmp['Name'] : $tmp['Comment']);
00333                     $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '')
00334                                            . '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')';
00335                 } // end while
00336             } // end if
00337 
00338             // garvin: Get comments from PMA comments table
00339             $db_tooltip = '';
00340             if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
00341                 $tmp_db_tooltip = PMA_getComments($db);
00342                 if (is_array($tmp_db_tooltip)) {
00343                     $db_tooltip = implode(' ', $tmp_db_tooltip);
00344                 }
00345             }
00346 
00347             // Builds the databases' names list
00348             if (!empty($db_start) && $db == $db_start) {
00349                 $table_title = array();
00350                 $table_array = array();
00351                 // Gets the list of tables from the current database
00352                 while (list($table) = PMA_DBI_fetch_row($tables)) {
00353                     $table_array[$table] = '';
00354                     $url_title  = (!empty($tooltip) && isset($tooltip[$table]))
00355                                 ? htmlspecialchars($tooltip[$table])
00356                                 : '';
00357                     $alias = (!empty($tooltip_name) && isset($tooltip_name[$table]))
00358                                 ? htmlspecialchars($tooltip_name[$table])
00359                                 : '';
00360                     $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
00361                 } // end while (tables list)
00362                 $selected = ' selected="selected"';
00363             } else {
00364                 $selected = '';
00365             } // end if... else...
00366 
00367             $db_disp = $db;
00368             if ($cfg['LeftFrameDBTree']) {
00369                 if ($i == 0) {
00370                     $parts = explode($cfg['LeftFrameDBSeparator'],$db,2);
00371                 } else {
00372                     $parts = $next_parts;
00373                 }
00374                 if ($i == $num_dbs - 1) {
00375                     $next_parts = array();
00376                 } else {
00377                     $next_parts = explode($cfg['LeftFrameDBSeparator'],$dblist[$i+1],2);
00378                 }
00379                 if (count($next_parts) > 1 && $parts[0] == $next_parts[0] && $parent != $parts[0]) {
00380                     echo '      '
00381                         . '<optgroup label="'.htmlspecialchars($parts[0]).'">'."\n";
00382                     $parent = $parts[0];
00383                 }
00384                 if (count($parts) > 1 && $parent == $parts[0]) {
00385                     $db_disp = $cfg['LeftFrameDBSeparator'] . $parts[1];
00386                 }
00387             }
00388             
00389             if (!empty($num_tables)) {
00390                 echo '            '
00391                    . '<option value="' . htmlspecialchars($db) . '"' . $selected . '>'
00392                    . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db_tooltip) : htmlspecialchars($db_disp)) . ' (' . $num_tables . ')</option>' . "\n";
00393             } else {
00394                 echo '            '
00395                    . '<option value="' . htmlspecialchars($db) . '"' . $selected . '>'
00396                    . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db_tooltip) : htmlspecialchars($db_disp)) . ' (-)</option>' . "\n";
00397             } // end if... else...
00398 
00399             if ($cfg['LeftFrameDBTree']) {
00400                 if (!empty($parent) && (count($next_parts) == 0 || $parent != $next_parts[0])) {
00401                     echo '      '
00402                         . '</optgroup>'."\n";
00403                     $parent = '';
00404                 }
00405             }
00406         } // end for $i (db list)
00407         ?>
00408         </select>
00409         <noscript>
00410             <input type="submit" name="Go" value="<?php echo $strGo; ?>" />
00411         </noscript>
00412         </form>
00413             </td>
00414         </tr>
00415     </table>
00416     <hr id="hr_third" />
00417     <?php
00418     } // end if LeftFrameLight
00419 } // end if num_db > 1
00420     ?>
00421     <form name="queryframeform" action="queryframe.php" method="get" style="margin:0px; padding:0px; display:none;">
00422         <input type="hidden" name="db" value="" />
00423         <input type="hidden" name="table" value="" />
00424         <input type="hidden" name="framename" value="queryframe" />
00425     </form>
00426     <form name="hashform" action="queryframe.php" style="margin:0px; padding:0px; display:none;">
00427         <input type="hidden" name="hash" value="<?php echo $hash; ?>" />
00428     </form>
00429     </div>
00430 </body>
00431 </html>
00432 
00433 <?php
00437 if (isset($dbh) && $dbh) {
00438     @PMA_DBI_close($dbh);
00439 }
00440 if (isset($userlink) && $userlink) {
00441     @PMA_DBI_close($userlink);
00442 }
00443 
00444 
00448 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
00449     && isset($ob_mode) && $ob_mode) {
00450      PMA_outBufferPost($ob_mode);
00451 }
00452 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6