Documentation TYPO3 par Ameos |
00001 <?php 00002 /* $Id: left.php,v 2.5 2003/12/09 13:38:16 garvinhicking Exp $ */ 00003 // vim: expandtab sw=4 ts=4 sts=4: 00004 00005 00010 require_once('./libraries/grab_globals.lib.php'); 00011 if (isset($lightm_db) && !empty($lightm_db)) { 00012 // no longer urlencoded because of html entities in the db name 00013 // $db = urldecode($lightm_db); 00014 $db = $lightm_db; 00015 } 00016 00017 if (!empty($db)) { 00018 $db_start = $db; 00019 } 00020 00021 00025 require_once('./libraries/common.lib.php'); 00026 require_once('./libraries/ob.lib.php'); 00027 if ($cfg['OBGzip']) { 00028 $ob_mode = PMA_outBufferModeGet(); 00029 if ($ob_mode) { 00030 PMA_outBufferPre($ob_mode); 00031 } 00032 } 00033 00034 // This check had been put here to avoid revealing the full path 00035 // of the phpMyAdmin directory in case this script is called 00036 // directly. But some users report a "Missing hash" message and 00037 // I cannot reproduce it, so let's define $hash to a dummy value 00038 // and hope some other clue will surface, to sort this bug. 00039 //PMA_checkParameters(array('hash')); 00040 if (!isset($hash)) { 00041 $hash=''; 00042 } 00043 00044 require_once('./libraries/bookmark.lib.php'); 00045 require_once('./libraries/relation.lib.php'); 00046 $cfgRelation = PMA_getRelationsParam(); 00047 00048 function PMA_reduceNest($_table) { 00049 00050 if ($GLOBALS['cfg']['LeftFrameTableLevel'] > 0) { 00051 $max = $GLOBALS['cfg']['LeftFrameTableLevel']; 00052 $temp_table = $_table; 00053 $new_table = array(); 00054 $last_index = 0; 00055 for ($ti = 0; $ti < $max; $ti++) { 00056 if (isset($temp_table[$ti])) { 00057 $new_table[$ti] = $temp_table[$ti]; 00058 unset($temp_table[$ti]); 00059 $last_index = $ti; 00060 } 00061 } 00062 00063 $_table = $new_table; 00064 } 00065 00066 return $_table; 00067 } 00068 00069 function PMA_indent($spaces) { 00070 $string = ''; 00071 for ($i = 0; $i <= $spaces; $i++) { 00072 $string .= ' '; 00073 } 00074 00075 return $string; 00076 } 00077 00078 function PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val, $childout = true) { 00079 $name = $key; 00080 $id = preg_replace('@[^a-z0-9]*@i', '', $baseid . $keyhistory . $key) . $indent; 00081 00082 $on_mouse = (($GLOBALS['cfg']['LeftPointerColor'] == '') ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $id . '\', \'' . $GLOBALS['cfg']['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $id . '\', \'' . $GLOBALS['cfg']['LeftBgColor'] . '\')}"'); 00083 00084 $countarray = $val; 00085 if (count($countarray) == 2 && isset($countarray['pma_name']) && isset($countarray['pma_list_item'])) { 00086 $counter = count($countarray['pma_name']); 00087 } else { 00088 unset($countarray['pma_name']); 00089 if (count($countarray) > 1) { 00090 unset($countarray['pma_list_item']); 00091 } 00092 $counter = count($countarray); 00093 } 00094 00095 echo "\n"; 00096 echo PMA_indent($indent * 5) . '<div id="el' . $id . 'Parent" class="parent"' . $on_mouse . '>' . "\n"; 00097 echo PMA_indent($indent * 6) . '<nobr><img src="images/spacer.gif" border="0" width="' . (($indent - 1) * $indent_level) . '" height="9" alt="" /><a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '" onclick="if (capable) {expandBase(\'el' . $id . '\', true); return false} else {return true}">'; 00098 echo '<img name="imEx" id="el' . $id . 'Img" src="images/plus.png" border="0" width="9" height="9" alt="+" /></a>' . "\n"; 00099 echo PMA_indent($indent * 6) . '<a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '" title="' . htmlspecialchars($name) . '" onclick="if (capable) {expandBase(\'el' . $id . '\', false)}"><span class="heada">' . htmlspecialchars($name) . '<bdo dir="' . $GLOBALS['text_dir'] . '"> </bdo></span><span class="headaCnt">(' . $counter . ')</span></a></nobr>' . "\n"; 00100 echo PMA_indent($indent * 5) . '</div><id class="PMA_nestedSetHeaderParent">' . "\n"; 00101 echo "\n"; 00102 00103 if ($childout) { 00104 echo PMA_indent($indent * 5) . '<div id="el' . $id . 'Child" class="child" ' . $on_mouse . '>' . "\n"; 00105 } 00106 } 00107 00108 function PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent_level, $headerOut, $firstGroup = false, $firstGroupClose = true) { 00109 if ($firstGroup) { 00110 PMA_nestedSetHeaderParent($baseid, $firstGroup, $keyhistory, $indent, $indent_level, $tablestack); 00111 $indent++; 00112 } 00113 00114 foreach($tablestack AS $key => $val) { 00115 if ($key != 'pma_name' && $key != 'pma_list_item') { 00116 if ($headerOut) { 00117 PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val); 00118 } 00119 00120 if (isset($val['pma_name']) && isset($val['pma_list_item']) && count($val) == 2) { 00121 PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, false, ($indent + 1)); 00122 } else { 00123 PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, true, ($indent + 1)); 00124 } 00125 00126 if ($headerOut) { 00127 echo PMA_indent($indent * 5) . '</div><id class="PMA_nestedSetHeader">' . "\n"; 00128 } 00129 } 00130 } 00131 00132 if ($firstGroup && $firstGroupClose) { 00133 echo PMA_indent($indent * 4) . '</div><id class="PMA_nestedSetHeader2">' . "\n"; 00134 } elseif ($firstGroup) { 00135 echo PMA_indent($indent * 4) . '<id spacer="div omitted" class="PMA_nestedSetHeader2">' . "\n"; 00136 } 00137 } 00138 00139 function PMA_nestedSet($baseid, $tablestack, $key = '__protected__', $keyhistory = '', $headerOut = false, $indent = 1) { 00140 00141 if ($keyhistory == '' && $key != '__protected__') { 00142 $keyhistory = $key; 00143 } 00144 00145 $indent_level = 9; 00146 00147 if (isset($tablestack) 00148 && isset($tablestack['pma_name']) 00149 && isset($tablestack['pma_list_item'])) { 00150 00151 if (count($tablestack) > 1 && !empty($key) && isset($tablestack['pma_name']) && isset($tablestack['pma_list_item']) && $indent == 1) { 00152 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, ($indent+1), $indent_level, $headerOut, $key, false); 00153 $divClose = true; 00154 $extra_indent = 1; 00155 } else { 00156 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent_level, $headerOut); 00157 $divClose = false; 00158 $extra_indent = 0; 00159 } 00160 00161 $on_mouse = (($GLOBALS['cfg']['LeftPointerColor'] == '') ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $keyhistory . $key . '\', \'' . $GLOBALS['cfg']['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $keyhistory . $key . '\', \'' . $GLOBALS['cfg']['LeftBgColor'] . '\')}"'); 00162 00163 $loops = 0; 00164 foreach($tablestack['pma_name'] AS $tkey => $tval) { 00165 00166 echo PMA_indent($indent * 5) . '<nobr><img src="images/spacer.gif" border="0" width="' . (($indent+$extra_indent) * $indent_level) . '" height="9" alt="" />'; 00167 $items = explode("\n", $tablestack['pma_list_item'][$tkey]); 00168 foreach($items AS $ikey => $ival) { 00169 echo "\n"; 00170 echo PMA_indent(($indent * 5)) . $ival; 00171 } 00172 echo "\n"; 00173 00174 $loops++; 00175 } 00176 00177 if ($divClose) { 00178 echo PMA_indent($indent * 5) . '</div><id space="putting omitted div" class="PMA_nestedSet2">'; 00179 } 00180 00181 } elseif (is_array($tablestack)) { 00182 PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, (($key == '__protected__' && $indent == 1 )? ($indent-1) : ($indent + 1)), $indent_level, $headerOut, (($key == '__protected__' && $indent == 1) || ($indent > 1) ? false : $key)); 00183 } 00184 00185 return true; 00186 } 00192 if ($server > 0) { 00193 PMA_availableDatabases(); // this function is defined in "common.lib.php" 00194 } else { 00195 $num_dbs = 0; 00196 } 00197 00198 00199 // garvin: For re-usability, moved http-headers 00200 // to a seperate file. It can now be included by header.inc.php, 00201 // queryframe.php, querywindow.php. 00202 00203 require_once('./libraries/header_http.inc.php'); 00204 00208 // Gets the font sizes to use 00209 PMA_setFontSizes(); 00210 ?> 00211 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 00212 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 00213 <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; ?>"> 00214 00215 <head> 00216 <title>phpMyAdmin</title> 00217 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" /> 00218 <base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> target="phpmain<?php echo $hash; ?>" /> 00219 00220 <script type="text/javascript" language="javascript"> 00221 <!-- 00222 <?php 00223 if (isset($lightm_db) && !empty($lightm_db)) { 00224 ?> 00225 window.parent.frames['phpmain<?php echo $hash; ?>'].location.replace('./<?php echo $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db, '', '&');?>'); 00226 <?php 00227 } elseif (isset($lightm_db)) { 00228 ?> 00229 window.parent.frames['phpmain<?php echo $hash; ?>'].location.replace('./main.php?<?php echo PMA_generate_common_url('', '', '&');?>'); 00230 <?php 00231 } 00232 ?> 00233 //--> 00234 </script> 00235 00236 <?php 00237 // Expandable/collapsible databases list is only used if there is more than one 00238 // database to display 00239 if (($num_dbs > 1 || !empty($cfg['LeftFrameTableSeparator'])) && !$cfg['LeftFrameLight']) { 00240 echo "\n"; 00241 ?> 00242 <!-- Collapsible tables list scripts --> 00243 <script type="text/javascript" language="javascript"> 00244 <!-- 00245 var isDOM = (typeof(document.getElementsByTagName) != 'undefined' 00246 && typeof(document.createElement) != 'undefined') 00247 ? 1 : 0; 00248 var isIE4 = (typeof(document.all) != 'undefined' 00249 && parseInt(navigator.appVersion) >= 4) 00250 ? 1 : 0; 00251 var isNS4 = (typeof(document.layers) != 'undefined') 00252 ? 1 : 0; 00253 var capable = (isDOM || isIE4 || isNS4) 00254 ? 1 : 0; 00255 // Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant 00256 if (capable) { 00257 if (typeof(window.opera) != 'undefined') { 00258 var browserName = ' ' + navigator.userAgent.toLowerCase(); 00259 if ((browserName.indexOf('konqueror 7') == 0)) { 00260 capable = 0; 00261 } 00262 } 00263 else if (typeof(navigator.userAgent) != 'undefined') { 00264 var browserName = ' ' + navigator.userAgent.toLowerCase(); 00265 if ((browserName.indexOf('konqueror') > 0) && (browserName.indexOf('konqueror/3') == 0)) { 00266 capable = 0; 00267 } 00268 } // end if... else if... 00269 } // end if 00270 00271 var isServer = <?php echo ($server > 0) ? 'true' : 'false'; ?>; 00272 00273 document.writeln('<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?lang=<?php echo $lang; ?>&js_frame=left&js_capable=' + capable + '&js_isDOM=' + isDOM + '&js_isIE4=' + isIE4 + '" />'); 00274 //--> 00275 </script> 00276 <noscript> 00277 <link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?lang=<?php echo $lang; ?>&js_frame=left&js_capable=0&js_isDOM=0&js_isIE4=0" /> 00278 </noscript> 00279 00280 <script src="libraries/left.js" type="text/javascript" language="javascript1.2"></script> 00281 <?php 00282 } // end if ($num_dbs > 1) 00283 00284 else if ($num_dbs == 1) { 00285 echo "\n"; 00286 ?> 00287 <link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?js_frame=left&js_capable=0&js_isDOM=0&js_isIE4=0" /> 00288 <?php 00289 } // end if ($num_dbs == 1) 00290 00291 else { 00292 echo "\n"; 00293 ?> 00294 <link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?js_frame=left&num_dbs=0" /> 00295 <?php 00296 } // end if ($num_dbs < 1) 00297 00298 echo "\n"; 00299 ?> 00300 </head> 00301 00302 <body bgcolor="<?php echo $cfg['LeftBgColor']; ?>"> 00303 00304 <?php 00305 if ($cfg['LeftDisplayLogo']) { 00306 ?> 00307 <!-- phpMyAdmin logo --> 00308 <a href="http://www.phpmyadmin.net" target="_blank"><img src="./images/pma_logo.png" width="88" height="31" border="0" alt="phpMyAdmin" /></a> 00309 <?php 00310 } 00311 echo "\n"; 00312 if ($cfg['LeftDisplayServers']) { 00313 ?> 00314 <form method="post" action="index.php" target="_parent"> 00315 <select name="server" onchange="this.form.submit();"> 00316 <?php 00317 echo "\n"; 00318 foreach($cfg['Servers'] AS $key => $val) { 00319 if (!empty($val['host'])) { 00320 echo ' <option value="' . $key . '"'; 00321 if (!empty($server) && ($server == $key)) { 00322 echo ' selected="selected"'; 00323 } 00324 echo '>'; 00325 if (!empty($val['verbose'])) { 00326 echo $val['verbose']; 00327 } else { 00328 echo $val['host']; 00329 if (!empty($val['port'])) { 00330 echo ':' . $val['port']; 00331 } 00332 // loic1: skip this because it's not a so good idea to display 00333 // sockets used to everybody 00334 // if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) { 00335 // echo ':' . $val['socket']; 00336 // } 00337 } 00338 // loic1: if 'only_db' is an array and there is more than one 00339 // value, displaying such informations may not be a so good 00340 // idea 00341 if (!empty($val['only_db'])) { 00342 echo ' - ' . (is_array($val['only_db']) ? implode(', ', $val['only_db']) : $val['only_db']); 00343 } 00344 if (!empty($val['user']) && ($val['auth_type'] == 'config')) { 00345 echo ' (' . $val['user'] . ')'; 00346 } 00347 echo ' </option>' . "\n"; 00348 } // end if (!empty($val['host'])) 00349 } // end while 00350 ?> 00351 </select> 00352 <input type="hidden" name="lang" value="<?php echo $lang; ?>" /> 00353 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" /> 00354 <noscript><input type="submit" value="<?php echo $strGo; ?>" /></noscript> 00355 </form> 00356 <?php 00357 } 00358 echo "\n"; 00359 ?> 00360 <!-- Link to the welcome page --> 00361 <div id="el1Parent" class="parent" style="margin-bottom: 5px"> 00362 <nobr><a class="item" href="main.php?<?php echo PMA_generate_common_url(); ?>"><span class="heada"><b><?php echo $strHome; ?></b></span></a></nobr> 00363 </div> 00364 00365 00366 <!-- Databases and tables list --> 00367 <?php 00368 // Don't display expansible/collapsible database info if: 00369 // 1. $server == 0 (no server selected) 00370 // This is the case when there are multiple servers and 00371 // '$cfg['ServerDefault'] = 0' is set. In that case, we want the welcome 00372 // screen to appear with no database info displayed. 00373 // 2. there is only one database available (ie either only one database exists 00374 // or $cfg['Servers']['only_db'] is defined and is not an array) 00375 // In this case, the database should not be collapsible/expandable 00376 if ($num_dbs > 1) { 00377 00378 // Light mode -> beginning of the select combo for databases 00379 // Note: When javascript is active, the frameset will be changed from 00380 // within left.php. With no JS (<noscript>) the whole frameset will 00381 // be rebuilt with the new target frame. 00382 if ($cfg['LeftFrameLight']) { 00383 ?> 00384 <script type="text/javascript" language="javascript"> 00385 document.writeln('<form method="post" action="left.php" name="left" target="nav">'); 00386 </script> 00387 <noscript> 00388 <form method="post" action="index.php" name="left" target="_parent"> 00389 </noscript> 00390 <?php 00391 echo PMA_generate_common_hidden_inputs(); 00392 echo ' <input type="hidden" name="hash" value="' . $hash . '" />' . "\n"; 00393 echo ' <select name="lightm_db" onchange="this.form.submit()">' . "\n"; 00394 echo ' <option value="">(' . $strDatabases . ') ...</option>' . "\n"; 00395 $table_list = ''; 00396 $table_list_header = ''; 00397 $db_name = ''; 00398 } 00399 00400 $selected_db = 0; 00401 00402 // Gets the tables list per database 00403 for ($i = 0; $i < $num_dbs; $i++) { 00404 $db = $dblist[$i]; 00405 $j = $i + 2; 00406 if (!empty($db_start) && $db == $db_start) { 00407 $selected_db = $j; 00408 } 00409 $tables = @PMA_mysql_list_tables($db); 00410 $num_tables = ($tables) ? @mysql_numrows($tables) : 0; 00411 $common_url_query = PMA_generate_common_url($db); 00412 if ($num_tables) { 00413 $num_tables_disp = $num_tables; 00414 } else { 00415 $num_tables_disp = '-'; 00416 } 00417 00418 // Get additional information about tables for tooltip 00419 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303 00420 && $num_tables 00421 && (!$cfg['LeftFrameLight'] || $selected_db == $j)) { 00422 $tooltip = array(); 00423 $tooltip_name = array(); 00424 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db)); 00425 while ($tmp = PMA_mysql_fetch_array($result)) { 00426 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : ''); 00427 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] ? $tmp['Name'] : $tmp['Comment']); 00428 00429 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '') 00430 . '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')'; 00431 } // end while 00432 } // end if 00433 00434 // garvin: Get comments from PMA comments table 00435 $db_tooltip = ''; 00436 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) { 00437 $tmp_db_tooltip = PMA_getComments($db); 00438 if (is_array($tmp_db_tooltip)) { 00439 $db_tooltip = implode(' ', $tmp_db_tooltip); 00440 } 00441 } 00442 00443 // No light mode -> displays the expandible/collapsible db list 00444 if ($cfg['LeftFrameLight'] == FALSE) { 00445 00446 // Displays the database name 00447 $on_mouse = (($cfg['LeftPointerColor'] == '') ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $j . '\', \'' . $cfg['LeftBgColor'] . '\')}"'); 00448 00449 echo "\n"; 00450 echo ' <div id="el' . $j . 'Parent" class="parent"' . $on_mouse . '>'; 00451 00452 if (!empty($num_tables)) { 00453 echo "\n"; 00454 ?> 00455 <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}"> 00456 <img name="imEx" id="el<?php echo $j; ?>Img" src="images/plus.png" border="0" width="9" height="9" alt="+" /></a> 00457 <?php 00458 } else { 00459 echo "\n"; 00460 ?> 00461 <nobr><img name="imEx" src="images/minus.png" border="0" width="9" height="9" alt="-" /> 00462 <?php 00463 } 00464 echo "\n"; 00465 ?> 00466 <a class="item" href="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>" title="<?php echo ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db) : htmlspecialchars($db_tooltip)); ?>" onclick="if (capable) {expandBase('el<?php echo $j; ?>', false)}"> 00467 <span class="heada"><?php echo ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? '<i>' . htmlspecialchars($db_tooltip) . '</i>' : htmlspecialchars($db)); ?><bdo dir="<?php echo($text_dir); ?>"> </bdo></span><span class="headaCnt">(<?php echo $num_tables_disp; ?>)</span></a></nobr> 00468 </div> 00469 00470 <div id="el<?php echo $j;?>Child" class="child" style="margin-bottom: 5px"<?php echo $on_mouse; ?>> 00471 <?php 00472 // Displays the list of tables from the current database 00473 $tablestack = array(); 00474 for ($t = 0; $t < $num_tables; $t++) { 00475 $table = PMA_mysql_tablename($tables, $t); 00476 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table])) 00477 ? htmlspecialchars($tooltip_name[$table]) 00478 : ''; 00479 $url_title = (!empty($tooltip) && isset($tooltip[$table])) 00480 ? htmlspecialchars($tooltip[$table]) 00481 : ''; 00482 00483 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); 00484 00485 $list_item = '<a target="phpmain' . $hash . '" href="sql.php?' . $common_url_query . '&table=' . urlencode($table) . '&sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&pos=0&goto=' . $cfg['DefaultTabTable'] . '" title="' . $strBrowse . ': ' . $url_title . '">'; 00486 $list_item .= '<img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" /></a>'; 00487 $list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n"; 00488 $list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">'; 00489 $list_item .= ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n"; 00490 00491 // garvin: Check whether to display nested sets 00492 if (!empty($cfg['LeftFrameTableSeparator'])) { 00493 $_table = explode($cfg['LeftFrameTableSeparator'], str_replace('\'', '\\\'',$table)); 00494 if (is_array($_table)) { 00495 foreach($_table AS $key => $val) { 00496 if ($val == '') { 00497 $_table[$key] = '__protected__'; 00498 } 00499 } 00500 00501 unset($_table[count($_table)-1]); 00502 $_table = PMA_reduceNest($_table); 00503 00504 $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $table) . '\';'; 00505 $eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . str_replace('\'', '\\\'', $list_item) . '\';'; 00506 eval($eval_string); 00507 } else { 00508 $tablestack['']['pma_name'][] = $table; 00509 $tablestack['']['pma_list_item'][] = $list_item; 00510 } 00511 } else { 00512 $tablestack['']['pma_name'][] = $table; 00513 $tablestack['']['pma_list_item'][] = $list_item; 00514 } 00515 } // end for $t (tables list) 00516 00517 PMA_nestedSet($j, $tablestack); 00518 ?> 00519 </div> 00520 <?php 00521 echo "\n"; 00522 00523 } 00524 00525 // Light mode -> displays the select combo with databases names and the 00526 // list of tables contained in the current database 00527 else { 00528 echo "\n"; 00529 00530 // Builds the databases' names list 00531 if (!empty($db_start) && $db == $db_start) { 00532 // Gets the list of tables from the current database 00533 for ($t = 0; $t < $num_tables; $t++) { 00534 $table = PMA_mysql_tablename($tables, $t); 00535 $url_title = (!empty($tooltip) && isset($tooltip[$table])) 00536 ? htmlentities($tooltip[$table]) 00537 : ''; 00538 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table])) 00539 ? htmlentities($tooltip_name[$table]) 00540 : ''; 00541 00542 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); 00543 00544 $table_list .= ' <nobr><a target="phpmain' . $hash . '" href="sql.php?' . $common_url_query . '&table=' . urlencode($table) . '&sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&pos=0&goto=' . $cfg['DefaultTabTable'] . '">' . "\n"; 00545 $table_list .= ' <img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" title="' . $strBrowse . ': ' . $url_title . '" /></a><bdo dir="' . $text_dir . '"> </bdo>' . "\n"; 00546 if (PMA_USR_BROWSER_AGENT == 'IE') { 00547 $table_list .= ' <span class="tblItem"><a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></span></nobr><br />' . "\n"; 00548 } else { 00549 $table_list .= ' <a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n"; 00550 } 00551 } // end for $t (tables list) 00552 00553 if (!$table_list) { 00554 $table_list = ' <br /><br />' . "\n" 00555 . ' <div>' . $strNoTablesFound . '</div>' . "\n"; 00556 } 00557 $selected = ' selected="selected"'; 00558 00559 $table_list_header .= ' <a class="item" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabDatabase'] . '?' . $common_url_query . '">' . "\n"; 00560 $table_list_header .= ' <span class="heada"><b>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasTB'] ? htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . '</b><bdo dir="' . $text_dir . '"> </bdo></span></a><br />' . "\n\n"; 00561 } else { 00562 $selected = ''; 00563 } // end if... else... 00564 00565 if (!empty($num_tables)) { 00566 echo ' <option value="' . htmlspecialchars($db) . '"' . $selected . '>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (' . $num_tables . ')</option>' . "\n"; 00567 } else { 00568 echo ' <option value="' . htmlspecialchars($db) . '"' . $selected . '>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . ' (-)</option>' . "\n"; 00569 } // end if... else... 00570 00571 } // end if (light mode) 00572 00573 } // end for $i (db list) 00574 00575 // Light mode -> end of the select combo for databases and table list for 00576 // the current database 00577 if ($cfg['LeftFrameLight']) { 00578 echo ' </select>' . "\n"; 00579 echo ' <noscript><input type="submit" name="Go" value="' . $strGo . '" /></noscript>' . "\n"; 00580 echo ' </form>' . "\n"; 00581 00582 if (!$table_list) { 00583 $table_list = ' <div>' . $strSelectADb . '</div>' . "\n"; 00584 } 00585 00586 // Displays the current database name and the list of tables it 00587 // contains 00588 echo "\n" . ' <hr noshade="noshade" />' . "\n\n"; 00589 echo $table_list_header; 00590 echo $table_list; 00591 echo "\n" . ' <hr noshade="noshade" />' . "\n"; 00592 } 00593 00594 // No light mode -> initialize some js variables for the 00595 // expandible/collapsible stuff 00596 else { 00597 ?> 00598 00599 <!-- Arrange collapsible/expandable db list at startup --> 00600 <script type="text/javascript" language="javascript1.2"> 00601 <!-- 00602 if (isNS4) { 00603 firstEl = 'el1Parent'; 00604 firstInd = nsGetIndex(firstEl); 00605 nsShowAll(); 00606 nsArrangeList(); 00607 } 00608 var expandedDb = '<?php echo (empty($selected_db)) ? '' : 'el' . $selected_db . 'Child'; ?>'; 00609 //--> 00610 </script> 00611 <?php 00612 00613 } // end if... else... (light mode) 00614 00615 } // end if ($server > 1) 00616 00617 00618 // Case where only one database has to be displayed 00619 else if ($num_dbs == 1) { 00620 $db = $dblist[0]; 00621 $tables = @PMA_mysql_list_tables($db); 00622 $num_tables = ($tables) ? @mysql_numrows($tables) : 0; 00623 $common_url_query = PMA_generate_common_url($db); 00624 if ($num_tables) { 00625 $num_tables_disp = $num_tables; 00626 } else { 00627 $num_tables_disp = '-'; 00628 } 00629 00630 // Get additional infomation about tables for tooltip 00631 if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303 00632 && $num_tables) { 00633 $tooltip = array(); 00634 $tooltip_name = array(); 00635 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db)); 00636 while ($tmp = PMA_mysql_fetch_array($result)) { 00637 $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : ''); 00638 $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] ? $tmp['Name'] : $tmp['Comment']); 00639 00640 $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '') 00641 . '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')'; 00642 } // end while 00643 } // end if 00644 00645 // garvin: Get comments from PMA comments table 00646 $db_tooltip = ''; 00647 if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) { 00648 $tmp_db_tooltip = PMA_getComments($db); 00649 if (is_array($tmp_db_tooltip)) { 00650 $db_tooltip = implode(' ', $tmp_db_tooltip); 00651 } 00652 } 00653 00654 00655 // Displays the database name 00656 if (!$cfg['LeftFrameLight']) { 00657 $on_mouse = (($cfg['LeftPointerColor'] == '') ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el2\', \'' . $cfg['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el2\', \'' . $cfg['LeftBgColor'] . '\')}"'); 00658 00659 echo "\n"; 00660 echo ' <div id="el2Parent" class="parent"' . $on_mouse . '>'; 00661 00662 if (!empty($num_tables)) { 00663 echo "\n"; 00664 ?> 00665 <nobr><a class="item" href="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>" onclick="if (capable) {expandBase('el2', true); return false} else {return true}"> 00666 <img name="imEx" id="el2Img" src="images/plus.png" border="0" width="9" height="9" alt="+" /></a> 00667 <?php 00668 } else { 00669 echo "\n"; 00670 ?> 00671 <nobr><img name="imEx" src="images/minus.png" border="0" width="9" height="9" alt="-" /> 00672 <?php 00673 } 00674 echo "\n"; 00675 ?> 00676 <a class="item" href="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>" title="<?php echo ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db) : htmlspecialchars($db_tooltip)); ?>" onclick="if (capable) {expandBase('el2', false)}"> 00677 <span class="heada"><?php echo ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? '<i>' . htmlspecialchars($db_tooltip) . '</i>' : htmlspecialchars($db)); ?><bdo dir="<?php echo($text_dir); ?>"> </bdo></span><span class="headaCnt">(<?php echo $num_tables_disp; ?>)</span></a></nobr> 00678 </div> 00679 00680 <div id="el2Child" class="child" style="margin-bottom: 5px"<?php echo $on_mouse; ?>> 00681 <?php 00682 } else { 00683 echo "\n"; 00684 ?> 00685 <div id="el2Parent" class="parent"> 00686 <nobr><a class="item" href="<?php echo $cfg['DefaultTabDatabase']; ?>?<?php echo $common_url_query; ?>"> 00687 <span class="heada"><?php echo ($db_tooltip != '' && $cfg['ShowTooltipAliasDB'] ? htmlspecialchars($db_tooltip) : htmlspecialchars($db)); ?><bdo dir="<?php echo($text_dir); ?>"> </bdo></span><span class="headaCnt">(<?php echo $num_tables_disp; ?>)</span></a></nobr> 00688 </div> 00689 <div id="el2Child" class="child" style="margin-bottom: 5px"> 00690 <?php 00691 } 00692 00693 // Displays the list of tables from the current database 00694 $tablestack = array(); 00695 for ($j = 0; $j < $num_tables; $j++) { 00696 $table = PMA_mysql_tablename($tables, $j); 00697 $alias = (!empty($tooltip_name) && isset($tooltip_name[$table])) 00698 ? htmlentities($tooltip_name[$table]) 00699 : ''; 00700 $url_title = (!empty($tooltip) && isset($tooltip[$table])) 00701 ? htmlentities($tooltip[$table]) 00702 : ''; 00703 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); 00704 00705 if ($cfg['LeftFrameLight']) { 00706 echo "\n"; 00707 ?> 00708 <nobr><a target="phpmain<?php echo $hash; ?>" href="sql.php?<?php echo $common_url_query; ?>&table=<?php echo urlencode($table); ?>&sql_query=<?php echo (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))); ?>&pos=0&goto=<?php echo $cfg['DefaultTabTable']; ?>" title="<?php echo $strBrowse . ': ' . $url_title; ?>"> 00709 <img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="<?php echo $strBrowse . ': ' . $url_title; ?>" /></a><bdo dir="<?php echo $text_dir; ?>"> </bdo> 00710 <a class="tblItem" id="tbl_<?php echo md5($table); ?>" title="<?php echo $url_title; ?>" target="phpmain<?php echo $hash; ?>" href="<?php echo $cfg['DefaultTabTable']; ?>?<?php echo $common_url_query; ?>&table=<?php echo urlencode($table); ?>"> 00711 <?php echo ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)); ?></a></nobr><br /> 00712 <?php 00713 } else { 00714 $list_item = '<a target="phpmain' . $hash . '" href="sql.php?' . $common_url_query . '&table=' . urlencode($table) . '&sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&pos=0&goto=' . $cfg['DefaultTabTable'] . '" title="' . $strBrowse . ': ' . $url_title . '">'; 00715 $list_item .= '<img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" /></a>'; 00716 $list_item .= '<bdo dir="' . $text_dir . '"> </bdo>' . "\n"; 00717 $list_item .= '<a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&table=' . urlencode($table) . '">'; 00718 $list_item .= ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></nobr><br />'; 00719 00720 // garvin: Check whether to display nested sets 00721 if (!empty($cfg['LeftFrameTableSeparator'])) { 00722 $_table = explode($cfg['LeftFrameTableSeparator'], str_replace('\'', '\\\'',$table)); 00723 if (is_array($_table)) { 00724 foreach($_table AS $key => $val) { 00725 if ($val == '') { 00726 $_table[$key] = '__protected__'; 00727 } 00728 } 00729 00730 unset($_table[count($_table)-1]); 00731 $_table = PMA_reduceNest($_table); 00732 00733 $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $table) . '\';'; 00734 $eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . str_replace('\'', '\\\'', $list_item) . '\';'; 00735 eval($eval_string); 00736 } else { 00737 $tablestack['']['pma_name'][] = $table; 00738 $tablestack['']['pma_list_item'][] = $list_item; 00739 } 00740 } else { 00741 $tablestack['']['pma_name'][] = $table; 00742 $tablestack['']['pma_list_item'][] = $list_item; 00743 } 00744 } 00745 } // end for $j (tables list) 00746 00747 if (!$cfg['LeftFrameLight']) { 00748 PMA_nestedSet('1', $tablestack); 00749 ?> 00750 </div> 00751 <!-- Arrange collapsible/expandable db list at startup --> 00752 <script type="text/javascript" language="javascript1.2"> 00753 <!-- 00754 if (isNS4) { 00755 firstEl = 'el1Parent'; 00756 firstInd = nsGetIndex(firstEl); 00757 nsShowAll(); 00758 nsArrangeList(); 00759 } 00760 var expandedDb = '<?php echo (empty($selected_db)) ? '' : 'el' . $selected_db . 'Child'; ?>'; 00761 //--> 00762 </script> 00763 <?php 00764 } else { 00765 echo ' </div>'; 00766 } 00767 00768 echo "\n"; 00769 } // end if ($num_dbs == 1) 00770 00771 00772 // Case where no database has to be displayed 00773 else { 00774 echo "\n"; 00775 echo '<p>' . $strNoDatabases . '</p>'; 00776 } // end if ($num_dbs == 0) 00777 echo "\n"; 00778 ?> 00779 00780 </body> 00781 </html> 00782 00783 <?php 00787 if (isset($dbh) && $dbh) { 00788 @mysql_close($dbh); 00789 } 00790 if (isset($userlink) && $userlink) { 00791 @mysql_close($userlink); 00792 } 00793 00794 00798 if (isset($cfg['OBGzip']) && $cfg['OBGzip'] 00799 && isset($ob_mode) && $ob_mode) { 00800 PMA_outBufferPost($ob_mode); 00801 } 00802 ?>