00001 <?php
00002
00003
00004
00048 function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
00049 {
00050 global $db, $table;
00051 global $unlim_num_rows, $fields_meta;
00052 global $err_url;
00053
00054
00055 $do_display = array();
00056 $do_display['edit_lnk'] = $the_disp_mode[0] . $the_disp_mode[1];
00057 $do_display['del_lnk'] = $the_disp_mode[2] . $the_disp_mode[3];
00058 $do_display['sort_lnk'] = (string) $the_disp_mode[4];
00059 $do_display['nav_bar'] = (string) $the_disp_mode[5];
00060 $do_display['ins_row'] = (string) $the_disp_mode[6];
00061 $do_display['bkm_form'] = (string) $the_disp_mode[7];
00062 $do_display['text_btn'] = (string) $the_disp_mode[8];
00063 $do_display['pview_lnk'] = (string) $the_disp_mode[9];
00064
00065
00066
00067 if ($the_disp_mode != 'nnnn000000') {
00068
00069 if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
00070 $do_display['edit_lnk'] = 'nn';
00071 $do_display['del_lnk'] = 'nn';
00072 $do_display['sort_lnk'] = (string) '0';
00073 $do_display['nav_bar'] = (string) '0';
00074 $do_display['ins_row'] = (string) '0';
00075 $do_display['bkm_form'] = (string) '0';
00076 $do_display['text_btn'] = (string) '0';
00077 $do_display['pview_lnk'] = (string) '0';
00078 }
00079
00080
00081
00082 else if ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain']) {
00083 $do_display['edit_lnk'] = 'nn';
00084 $do_display['del_lnk'] = 'nn';
00085 $do_display['sort_lnk'] = (string) '0';
00086 $do_display['nav_bar'] = (string) '0';
00087 $do_display['ins_row'] = (string) '0';
00088 $do_display['bkm_form'] = (string) '1';
00089 if ($GLOBALS['is_analyse']) {
00090 $do_display['text_btn'] = (string) '1';
00091 } else {
00092 $do_display['text_btn'] = (string) '0';
00093 }
00094 $do_display['pview_lnk'] = (string) '1';
00095 }
00096
00097 else if ($GLOBALS['is_show']) {
00098
00099 $tmp = preg_match('@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS)@i', $GLOBALS['sql_query'], $which = array() );
00100 if (isset($which[1]) && strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) {
00101 $do_display['edit_lnk'] = 'nn';
00102 $do_display['del_lnk'] = 'kp';
00103 }
00104 else {
00105
00106 $do_display['edit_lnk'] = 'nn';
00107 $do_display['del_lnk'] = 'nn';
00108 }
00109
00110 $do_display['sort_lnk'] = (string) '0';
00111 $do_display['nav_bar'] = (string) '0';
00112 $do_display['ins_row'] = (string) '0';
00113 $do_display['bkm_form'] = (string) '1';
00114 $do_display['text_btn'] = (string) '1';
00115 $do_display['pview_lnk'] = (string) '1';
00116 }
00117
00118
00119
00120 else {
00121 $prev_table = $fields_meta[0]->table;
00122 $do_display['text_btn'] = (string) '1';
00123 for ($i = 0; $i < $GLOBALS['fields_cnt']; $i++) {
00124 $is_link = ($do_display['edit_lnk'] != 'nn'
00125 || $do_display['del_lnk'] != 'nn'
00126 || $do_display['sort_lnk'] != '0'
00127 || $do_display['ins_row'] != '0');
00128
00129 if ($is_link
00130 && ($fields_meta[$i]->table == '' || $fields_meta[$i]->table != $prev_table)) {
00131 $do_display['edit_lnk'] = 'nn';
00132 $do_display['del_lnk'] = 'nn';
00133
00134
00135
00136 $do_display['ins_row'] = (string) '0';
00137 if ($do_display['text_btn'] == '1') {
00138 break;
00139 }
00140 }
00141
00142 $do_display['pview_lnk'] = (string) '1';
00143 $prev_table = $fields_meta[$i]->table;
00144 }
00145 }
00146 }
00147
00148
00149 if (isset($unlim_num_rows) && $unlim_num_rows != '') {
00150 $the_total = $unlim_num_rows;
00151 }
00152 else if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1')
00153 && (!empty($db) && !empty($table))) {
00154 $the_total = PMA_countRecords($db, $table, TRUE);
00155 }
00156
00157
00158
00159
00160 if ($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') {
00161
00162 if (isset($unlim_num_rows) && $unlim_num_rows < 2) {
00163
00164
00165 $do_display['sort_lnk'] = (string) '0';
00166 }
00167
00168 }
00169
00170
00171 $the_disp_mode = join('', $do_display);
00172
00173 return $do_display;
00174 }
00175
00176
00207 function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query)
00208 {
00209 global $db, $table, $goto, $dontlimitchars;
00210 global $num_rows, $unlim_num_rows, $pos, $session_max_rows;
00211 global $disp_direction, $repeat_cells;
00212 global $is_innodb;
00213 global $showtable;
00214
00215
00216
00217 $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
00218
00219 ?>
00220
00221 <!-- Navigation bar -->
00222 <table border="0" cellpadding="2" cellspacing="0">
00223 <tr>
00224 <?php
00225
00226 if ($pos > 0 && $session_max_rows != 'all') {
00227
00228 if ($GLOBALS['cfg']['NavigationBarIconic']) {
00229 $caption1 = '<<';
00230 $caption2 = ' < ';
00231 $title1 = ' title="' . $GLOBALS['strPos1'] . '"';
00232 $title2 = ' title="' . $GLOBALS['strPrevious'] . '"';
00233 } else {
00234 $caption1 = $GLOBALS['strPos1'] . ' <<';
00235 $caption2 = $GLOBALS['strPrevious'] . ' <';
00236 $title1 = '';
00237 $title2 = '';
00238 }
00239 ?>
00240 <td>
00241 <form action="sql.php" method="post">
00242 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00243 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00244 <input type="hidden" name="pos" value="0" />
00245 <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
00246 <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
00247 <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
00248 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00249 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00250 <input type="submit" name="navig" value="<?php echo $caption1; ?>"<?php echo $title1; ?> />
00251 </form>
00252 </td>
00253 <td>
00254 <form action="sql.php" method="post">
00255 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00256 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00257 <input type="hidden" name="pos" value="<?php echo $pos_prev; ?>" />
00258 <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
00259 <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
00260 <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
00261 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00262 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00263 <input type="submit" name="navig" value="<?php echo $caption2; ?>"<?php echo $title2; ?> />
00264 </form>
00265 </td>
00266 <?php
00267 }
00268 echo "\n";
00269 ?>
00270 <td>
00271
00272 </td>
00273 <td align="center">
00274 <form action="sql.php" method="post"
00275 onsubmit="return (checkFormElementInRange(this, 'session_max_rows', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidRowNumber']); ?>', 1) && checkFormElementInRange(this, 'pos', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidRowNumber']); ?>', 0, <?php echo $unlim_num_rows - 1; ?>))">
00276 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00277 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00278 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00279 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00280 <input type="submit" name="navig" value="<?php echo $GLOBALS['strShow']; ?> :" />
00281 <input type="text" name="session_max_rows" size="3" value="<?php echo (($session_max_rows != 'all') ? $session_max_rows : $GLOBALS['cfg']['MaxRows']); ?>" class="textfield" onfocus="this.select()" />
00282 <?php echo $GLOBALS['strRowsFrom'] . "\n"; ?>
00283 <input type="text" name="pos" size="6" value="<?php echo (($pos_next >= $unlim_num_rows) ? 0 : $pos_next); ?>" class="textfield" onfocus="this.select()" />
00284 <br />
00285 <?php
00286
00287 $param1 = ' <select name="disp_direction">' . "\n"
00288 . ' <option value="horizontal"' . (($disp_direction == 'horizontal') ? ' selected="selected"': '') . '>' . $GLOBALS['strRowsModeHorizontal'] . '</option>' . "\n"
00289 . ' <option value="horizontalflipped"' . (($disp_direction == 'horizontalflipped') ? ' selected="selected"': '') . '>' . $GLOBALS['strRowsModeFlippedHorizontal'] . '</option>' . "\n"
00290 . ' <option value="vertical"' . (($disp_direction == 'vertical') ? ' selected="selected"': '') . '>' . $GLOBALS['strRowsModeVertical'] . '</option>' . "\n"
00291 . ' </select>' . "\n"
00292 . ' ';
00293 $param2 = ' <input type="text" size="3" name="repeat_cells" value="' . $repeat_cells . '" class="textfield" />' . "\n"
00294 . ' ';
00295 echo ' ' . sprintf($GLOBALS['strRowsModeOptions'], "\n" . $param1, "\n" . $param2) . "\n";
00296 ?>
00297 </form>
00298 </td>
00299 <td>
00300
00301 </td>
00302 <?php
00303
00304 if (($pos + $session_max_rows < $unlim_num_rows) && $num_rows >= $session_max_rows
00305 && $session_max_rows != 'all') {
00306
00307 if ($GLOBALS['cfg']['NavigationBarIconic']) {
00308 $caption3 = ' > ';
00309 $caption4 = '>>';
00310 $title3 = ' title="' . $GLOBALS['strNext'] . '"';
00311 $title4 = ' title="' . $GLOBALS['strEnd'] . '"';
00312 } else {
00313 $caption3 = '> ' . $GLOBALS['strNext'];
00314 $caption4 = '>> ' . $GLOBALS['strEnd'];
00315 $title3 = '';
00316 $title4 = '';
00317 }
00318 echo "\n";
00319 ?>
00320 <td>
00321 <form action="sql.php" method="post">
00322 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00323 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00324 <input type="hidden" name="pos" value="<?php echo $pos_next; ?>" />
00325 <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
00326 <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
00327 <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
00328 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00329 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00330 <input type="submit" name="navig" value="<?php echo $caption3; ?>"<?php echo $title3; ?> />
00331 </form>
00332 </td>
00333 <td>
00334 <form action="sql.php" method="post"
00335 onsubmit="return <?php echo (($pos + $session_max_rows < $unlim_num_rows && $num_rows >= $session_max_rows) ? 'true' : 'false'); ?>">
00336 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00337 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00338 <input type="hidden" name="pos" value="<?php echo @((ceil($unlim_num_rows / $session_max_rows)- 1) * $session_max_rows); ?>" />
00339 <?php
00340 if ($is_innodb && $unlim_num_rows > $GLOBALS['cfg']['MaxExactCount']) {
00341 echo '<input type="hidden" name="find_real_end" value="1" />' . "\n";
00342
00343 $onclick = ' onclick="return confirmAction(\'' . PMA_jsFormat($GLOBALS['strLongOperation'], FALSE) . '\')"';
00344 }
00345 ?>
00346 <input type="hidden" name="session_max_rows" value="<?php echo $session_max_rows; ?>" />
00347 <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
00348 <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
00349 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00350 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00351 <input type="submit" name="navig" value="<?php echo $caption4; ?>"<?php echo $title4; ?> <?php echo (empty($onclick) ? '' : $onclick); ?>/>
00352 </form>
00353 </td>
00354 <?php
00355 }
00356
00357
00358
00359 $pageNow = @floor($pos / $session_max_rows) + 1;
00360 $nbTotalPage = @ceil($unlim_num_rows / $session_max_rows);
00361
00362 if ($nbTotalPage > 1){
00363 ?>
00364 <td>
00365
00366 </td>
00367 <td>
00368 <?php
00369 <form>
00370 <?php echo PMA_pageselector(
00371 'sql.php?sql_query=' . $encoded_query .
00372 '&session_max_rows=' . $session_max_rows .
00373 '&disp_direction=' . $disp_direction .
00374 '&repeat_cells=' . $repeat_cells .
00375 '&goto=' . $goto .
00376 '&dontlimitchars=' . $dontlimitchars .
00377 '&' . PMA_generate_common_url($db, $table) .
00378 '&',
00379 $session_max_rows,
00380 $pageNow,
00381 $nbTotalPage
00382 );
00383 ?>
00384 </form>
00385 </td>
00386 <?php
00387 }
00388
00389
00390
00391 if ($GLOBALS['cfg']['ShowAll'] && ($num_rows < $unlim_num_rows)) {
00392 echo "\n";
00393 ?>
00394 <td>
00395
00396 </td>
00397 <td>
00398 <form action="sql.php" method="post">
00399 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00400 <input type="hidden" name="sql_query" value="<?php echo $encoded_query; ?>" />
00401 <input type="hidden" name="pos" value="0" />
00402 <input type="hidden" name="session_max_rows" value="all" />
00403 <input type="hidden" name="disp_direction" value="<?php echo $disp_direction; ?>" />
00404 <input type="hidden" name="repeat_cells" value="<?php echo $repeat_cells; ?>" />
00405 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
00406 <input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
00407 <input type="submit" name="navig" value="<?php echo $GLOBALS['strShowAll']; ?>" />
00408 </form>
00409 </td>
00410 <?php
00411 }
00412 echo "\n";
00413 ?>
00414 </tr>
00415 </table>
00416
00417 <?php
00418 }
00419
00420
00452 function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $analyzed_sql = '')
00453 {
00454 global $db, $table, $goto, $dontlimitchars;
00455 global $sql_query, $num_rows, $pos, $session_max_rows;
00456 global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns;
00457
00458 if ($analyzed_sql == '') {
00459 $analyzed_sql = array();
00460 }
00461
00462
00463 if ($is_display['sort_lnk'] == '1') {
00464
00465
00466 $unsorted_sql_query = $sql_query;
00467 if (isset($analyzed_sql[0]['unsorted_query'])) {
00468 $unsorted_sql_query = $analyzed_sql[0]['unsorted_query'];
00469 }
00470
00471
00472
00473
00474 $sort_expression = trim(str_replace(' ', ' ',$analyzed_sql[0]['order_by_clause']));
00475
00476
00477 preg_match('@(.*)([[:space:]]*(ASC|DESC))@si',$sort_expression,$matches = array());
00478 $sort_expression_nodir = isset($matches[1]) ? trim($matches[1]) : $sort_expression;
00479
00480
00481 if (isset($analyzed_sql) && isset($analyzed_sql[0]) &&
00482 isset($analyzed_sql[0]['querytype']) && $analyzed_sql[0]['querytype'] == 'SELECT' &&
00483 isset($analyzed_sql[0]['table_ref']) && count($analyzed_sql[0]['table_ref']) == 1) {
00484
00485
00486 PMA_DBI_select_db($db);
00487 if (!defined('PMA_IDX_INCLUDED')) {
00488 $ret_keys = PMA_get_indexes($table);
00489 }
00490
00491 $prev_index = '';
00492 foreach ($ret_keys as $row) {
00493
00494 if ($row['Key_name'] != $prev_index ){
00495 $indexes[] = $row['Key_name'];
00496 $prev_index = $row['Key_name'];
00497 }
00498 $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index'];
00499 $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique'];
00500 if (isset($row['Cardinality'])) {
00501 $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality'];
00502 }
00503
00504
00505 $indexes_info[$row['Key_name']]['Comment'] = (isset($row['Comment']))
00506 ? $row['Comment']
00507 : '';
00508 $indexes_info[$row['Key_name']]['Index_type'] = (isset($row['Index_type']))
00509 ? $row['Index_type']
00510 : '';
00511
00512 $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name'];
00513 if (isset($row['Sub_part'])) {
00514 $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part'];
00515 }
00516 }
00517
00518
00519 if (isset($indexes_data)) {
00520
00521 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00522 $span = $fields_cnt;
00523 if ($is_display['edit_lnk'] != 'nn') $span++;
00524 if ($is_display['del_lnk'] != 'nn') $span++;
00525 if ($is_display['del_lnk'] != 'kp' && $is_display['del_lnk'] != 'nn') $span++;
00526 } else {
00527 $span = $num_rows + floor($num_rows/$repeat_cells) + 1;
00528 }
00529
00530 echo '<form action="sql.php" method="post">' . "\n";
00531 echo PMA_generate_common_hidden_inputs($db, $table, 5);
00532 echo '<input type="hidden" name="pos" value="' . $pos . '" />' . "\n";
00533 echo '<input type="hidden" name="session_max_rows" value="' . $session_max_rows . '" />' . "\n";
00534 echo '<input type="hidden" name="disp_direction" value="' . $disp_direction . '" />' . "\n";
00535 echo '<input type="hidden" name="repeat_cells" value="' . $repeat_cells . '" />' . "\n";
00536 echo '<input type="hidden" name="dontlimitchars" value="' . $dontlimitchars . '" />' . "\n";
00537 echo $GLOBALS['strSortByKey'] . ': <select name="sql_query">' . "\n";
00538 $used_index = false;
00539 $local_order = (isset($sort_expression) ? $sort_expression : '');
00540 foreach ($indexes_data AS $key => $val) {
00541 $asc_sort = '';
00542 $desc_sort = '';
00543 foreach ($val AS $key2 => $val2) {
00544 $asc_sort .= PMA_backquote($val2['Column_name']) . ' ASC , ';
00545 $desc_sort .= PMA_backquote($val2['Column_name']) . ' DESC , ';
00546 }
00547 $asc_sort = substr($asc_sort, 0, -3);
00548 $desc_sort = substr($desc_sort, 0, -3);
00549 $used_index = $used_index || $local_order == $asc_sort || $local_order == $desc_sort;
00550 echo '<option value="' . htmlspecialchars($unsorted_sql_query . ' ORDER BY ' . $asc_sort) . '"' . ($local_order == $asc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($key) . ' (' . $GLOBALS['strAscending'] . ')</option>';
00551 echo "\n";
00552 echo '<option value="' . htmlspecialchars($unsorted_sql_query . ' ORDER BY ' . $desc_sort) . '"' . ($local_order == $desc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($key) . ' (' . $GLOBALS['strDescending'] . ')</option>';
00553 echo "\n";
00554 }
00555 echo '<option value="' . htmlspecialchars($unsorted_sql_query) . '"' . ($used_index ? '' : ' selected="selected"' ) . '>' . $GLOBALS['strNone'] . '</option>';
00556 echo "\n";
00557 echo '</select> ';
00558 echo "\n";
00559 echo '<input type="submit" value="' . $GLOBALS['strGo'] . '" />';
00560 echo "\n";
00561 echo '</form>';
00562 echo "\n";
00563 }
00564 }
00565 }
00566
00567
00568 $vertical_display['emptypre'] = 0;
00569 $vertical_display['emptyafter'] = 0;
00570 $vertical_display['textbtn'] = '';
00571
00572
00573
00574
00575 if ($is_display['del_lnk'] == 'dr' || $is_display['del_lnk'] == 'kp' ) {
00576 echo '<form method="post" action="tbl_row_action.php" name="rowsDeleteForm">' . "\n";
00577 echo PMA_generate_common_hidden_inputs($db, $table, 1);
00578 echo '<input type="hidden" name="disp_direction" value="' . $disp_direction . '" />' . "\n";
00579 echo '<input type="hidden" name="repeat_cells" value="' . $repeat_cells . '" />' . "\n";
00580 echo '<input type="hidden" name="dontlimitchars" value="' . $dontlimitchars . '" />' . "\n";
00581 echo '<input type="hidden" name="pos" value="' . $pos . '" />' . "\n";
00582 echo '<input type="hidden" name="session_max_rows" value="' . $session_max_rows . '" />' . "\n";
00583 echo '<input type="hidden" name="goto" value="sql.php" />' . "\n";
00584 }
00585
00586 echo '<!-- Results table -->' . "\n"
00587 . '<table id="table_results" ';
00588 if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
00589 echo 'border="1" cellpadding="2" cellspacing="0"';
00590 } else {
00591 echo 'border="' . $GLOBALS['cfg']['Border'] . '" cellpadding="2" cellspacing="1"';
00592 }
00593 echo '>' . "\n";
00594 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00595 ?>
00596 <!-- Results table headers -->
00597 <tr>
00598 <?php
00599 }
00600
00601
00602 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00603 $colspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
00604 ? ' colspan="3"'
00605 : '';
00606 } else {
00607 $rowspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
00608 ? ' rowspan="3"'
00609 : '';
00610 }
00611 $text_url = 'sql.php?'
00612 . PMA_generate_common_url($db, $table)
00613 . '&sql_query=' . urlencode($sql_query)
00614 . '&pos=' . $pos
00615 . '&session_max_rows=' . $session_max_rows
00616 . '&pos=' . $pos
00617 . '&disp_direction=' . $disp_direction
00618 . '&repeat_cells=' . $repeat_cells
00619 . '&goto=' . $goto
00620 . '&dontlimitchars=' . (($dontlimitchars) ? 0 : 1);
00621 $text_message = '<img src="' . $GLOBALS['pmaThemeImage'] . 's_'.($dontlimitchars ? 'partialtext' : 'fulltext') . '.png" border="0" width="50" height="20" alt="' . ($dontlimitchars ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" title="' . ($dontlimitchars ? $GLOBALS['strPartialText'] : $GLOBALS['strFullText']) . '" />';
00622 $text_link = PMA_linkOrButton( $text_url, $text_message, array(), false );
00623
00624
00625 if (($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
00626 && $is_display['text_btn'] == '1') {
00627 $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 0;
00628 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00629 ?>
00630 <th class="td" colspan="<?php echo $fields_cnt; ?>" align="center">
00631 <?php echo $text_link; ?>
00632 </th>
00633 </tr>
00634
00635 <tr>
00636 <?php
00637 }
00638 else {
00639 echo "\n";
00640 ?>
00641 <tr>
00642 <th class="td" colspan="<?php echo $num_rows + floor($num_rows/$repeat_cells) + 1; ?>" align="center">
00643 <?php echo $text_link; ?>
00644 </th>
00645 </tr>
00646 <?php
00647 }
00648 }
00649
00650
00651
00652 else if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && $is_display['text_btn'] == '1') {
00653 $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 0;
00654 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00655 echo "\n";
00656 ?>
00657 <th class="td" <?php echo $colspan; ?> align="center">
00658 <?php echo $text_link; ?>
00659 </th>
00660 <?php
00661 }
00662 else {
00663 $vertical_display['textbtn'] = ' <th class="td" ' . $rowspan . ' align="center" valign="middle">' . "\n"
00664 . ' ' . $text_link . "\n"
00665 . ' </th>' . "\n";
00666 }
00667 }
00668
00669
00670 else if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
00671 && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) {
00672 $vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 0;
00673 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00674 echo "\n";
00675 ?>
00676 <td<?php echo $colspan; ?>></td>
00677 <?php
00678 echo "\n";
00679 }
00680 else {
00681 $vertical_display['textbtn'] = ' <td' . $rowspan . '></td>' . "\n";
00682 }
00683 }
00684
00685
00686
00687
00688
00689
00690
00691 if ($GLOBALS['cfg']['ShowBrowseComments'] && $GLOBALS['cfgRelation']['commwork'] && $disp_direction != 'horizontalflipped') {
00692 $comments_map = array();
00693 foreach ($analyzed_sql[0]['table_ref'] as $tbl) {
00694
00695 $tb = $tbl['table_true_name'];
00696
00697 $comments_map[$tb] = PMA_getComments($db, $tb);
00698 }
00699 }
00700
00701 if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
00702 require_once('./libraries/transformations.lib.php');
00703 $GLOBALS['mime_map'] = PMA_getMIME($db, $table);
00704 }
00705
00706 if ($is_display['sort_lnk'] == '1') {
00707
00708 $is_join = (isset($analyzed_sql[0]['queryflags']['join']) ?TRUE:FALSE);
00709 $select_expr = $analyzed_sql[0]['select_expr_clause'];
00710 } else {
00711 $is_join = FALSE;
00712 }
00713
00714
00715
00716 $highlight_columns = array();
00717 if (isset($analyzed_sql) && isset($analyzed_sql[0]) &&
00718 isset($analyzed_sql[0]['where_clause_identifiers'])) {
00719
00720 $wi = 0;
00721 if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) {
00722 foreach ($analyzed_sql[0]['where_clause_identifiers'] AS $wci_nr => $wci) {
00723 $highlight_columns[$wci] = 'true';
00724 }
00725 }
00726 }
00727
00728 for ($i = 0; $i < $fields_cnt; $i++) {
00729
00730
00731 if (isset($highlight_columns[$fields_meta[$i]->name]) || isset($highlight_columns[PMA_backquote($fields_meta[$i]->name)])) {
00732 $column_style = 'style="border: 1px solid ' . $GLOBALS['cfg']['BrowseMarkerColor'] . '"';
00733 } else {
00734 $column_style = '';
00735 }
00736
00737
00738 if (isset($comments_map) &&
00739 isset($comments_map[$fields_meta[$i]->table]) &&
00740 isset($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name])) {
00741 $comments = '<span class="tblcomment">' . htmlspecialchars($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name]) . '</span>';
00742 } else {
00743 $comments = '';
00744 }
00745
00746
00747 if ($is_display['sort_lnk'] == '1') {
00748
00749
00750
00751
00752
00753
00754
00755 if (($is_join
00756 && !preg_match('~([^[:space:],]|`[^`]`)[[:space:]]+(as[[:space:]]+)?' . $fields_meta[$i]->name . '~i', $select_expr, $parts = array()))
00757 || ( isset($analyzed_sql[0]['select_expr'][$i]['expr'])
00758 && isset($analyzed_sql[0]['select_expr'][$i]['column'])
00759 && $analyzed_sql[0]['select_expr'][$i]['expr'] !=
00760 $analyzed_sql[0]['select_expr'][$i]['column']
00761 && !empty($fields_meta[$i]->table)) ) {
00762 $sort_tbl = PMA_backquote($fields_meta[$i]->table) . ' . ';
00763 } else {
00764 $sort_tbl = '';
00765 }
00766
00767
00768 if (empty($sort_expression)) {
00769 $is_in_sort = FALSE;
00770 } else {
00771
00772
00773
00774
00775
00776
00777 $is_in_sort = ($sort_tbl . PMA_backquote($fields_meta[$i]->name) == $sort_expression_nodir ? TRUE : FALSE);
00778 }
00779
00780
00781
00782 if (strpos(' ' . $fields_meta[$i]->name, '`') > 0) {
00783 $sort_order = ' ORDER BY \'' . $fields_meta[$i]->name . '\' ';
00784 } else {
00785 $sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ';
00786 }
00787
00788
00789 if (!$is_in_sort) {
00790
00791 $GLOBALS['cfg']['Order'] = strtoupper($GLOBALS['cfg']['Order']);
00792 if ($GLOBALS['cfg']['Order'] == 'SMART') {
00793 $GLOBALS['cfg']['Order'] = (preg_match('@time|date@i', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
00794 }
00795 $sort_order .= $GLOBALS['cfg']['Order'];
00796 $order_img = '';
00797 }
00798 else if (preg_match('@[[:space:]]ASC$@i', $sort_expression)) {
00799 $sort_order .= ' DESC';
00800 $order_img = ' <img src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="soimg' . $i . '" />';
00801 }
00802 else if (preg_match('@[[:space:]]DESC$@i', $sort_expression)) {
00803 $sort_order .= ' ASC';
00804 $order_img = ' <img src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="soimg' . $i . '" />';
00805 } else {
00806 $sort_order .= ' DESC';
00807 $order_img = ' <img src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" border="0" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="soimg' . $i . '" />';
00808 }
00809
00810 if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@i', $unsorted_sql_query, $regs3 = array())) {
00811 $sorted_sql_query = $regs3[1] . $sort_order . $regs3[2];
00812 } else {
00813 $sorted_sql_query = $unsorted_sql_query . $sort_order;
00814 }
00815 $url_query = PMA_generate_common_url($db, $table)
00816 . '&pos=' . $pos
00817 . '&session_max_rows=' . $session_max_rows
00818 . '&disp_direction=' . $disp_direction
00819 . '&repeat_cells=' . $repeat_cells
00820 . '&dontlimitchars=' . $dontlimitchars
00821 . '&sql_query=' . urlencode($sorted_sql_query);
00822 $order_url = 'sql.php?' . $url_query;
00823
00824
00825
00826
00827 $order_link_params = array();
00828 if (isset($order_img) && $order_img!='') {
00829 if (strstr($order_img,'asc')) {
00830 $order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
00831 $order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
00832 } else if (strstr($order_img,'desc')) {
00833 $order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
00834 $order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
00835 }
00836 }
00837 if ( $disp_direction == 'horizontalflipped'
00838 && $GLOBALS['cfg']['HeaderFlipType'] == 'css' ) {
00839 $order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;';
00840 }
00841 $order_link_params['title'] = $GLOBALS['strSort'];
00842 $order_link_content = ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name));
00843 $order_link = PMA_linkOrButton( $order_url, $order_link_content . $order_img, $order_link_params, false, true );
00844
00845 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00846 echo "\n";
00847 ?>
00848 <th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') echo 'valign="bottom"'; ?>>
00849 <?php echo $order_link; ?>
00850 <?php echo $comments; ?>
00851 </th>
00852 <?php
00853 }
00854 $vertical_display['desc'][] = ' <th ' . $column_style . '>' . "\n"
00855 . $order_link
00856 . $comments
00857 . ' </th>' . "\n";
00858 }
00859
00860
00861 else {
00862 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00863 echo "\n";
00864 ?>
00865 <th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') echo 'valign="bottom"'; ?> <?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css' ? 'style="direction: ltr; writing-mode: tb-rl;"' : ''); ?>>
00866 <?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake'? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name)) . "\n"; ?>
00867 <?php echo $comments; ?>
00868 </th>
00869 <?php
00870 }
00871 $vertical_display['desc'][] = ' <th ' . $column_style . '>' . "\n"
00872 . ' ' . htmlspecialchars($fields_meta[$i]->name) . "\n"
00873 . $comments
00874 . ' </th>';
00875 }
00876 }
00877
00878
00879
00880 if ($GLOBALS['cfg']['ModifyDeleteAtRight']
00881 && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')
00882 && $is_display['text_btn'] == '1') {
00883 $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1;
00884 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00885 echo "\n";
00886 ?>
00887 <th class="td" <?php echo $colspan; ?> align="center">
00888 <?php echo $text_link; ?>
00889 </th>
00890 <?php
00891 }
00892 else {
00893 $vertical_display['textbtn'] = ' <th class="td" ' . $rowspan . ' align="center" valign="middle">' . "\n"
00894 . ' ' . $text_link . "\n"
00895 . ' </th>' . "\n";
00896 }
00897 }
00898
00899
00900
00901 else if ($GLOBALS['cfg']['ModifyDeleteAtRight']
00902 && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
00903 && (!$GLOBALS['is_header_sent'])) {
00904 $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1;
00905 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00906 echo "\n";
00907 ?>
00908 <td<?php echo $colspan; ?>></td>
00909 <?php
00910 }
00911 else {
00912 $vertical_display['textbtn'] = ' <td' . $rowspan . '></td>' . "\n";
00913 }
00914 }
00915
00916 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
00917 echo "\n";
00918 ?>
00919 </tr>
00920 <?php
00921 }
00922 echo "\n";
00923
00924 return TRUE;
00925 }
00926
00927
00928
00964 function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
00965 {
00966 global $db, $table, $goto, $dontlimitchars;
00967 global $sql_query, $pos, $session_max_rows, $fields_meta, $fields_cnt;
00968 global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns;
00969 global $row;
00970
00971 $url_sql_query = $sql_query;
00972
00973
00974
00975
00976 if (isset($analyzed_sql) && isset($analyzed_sql[0]) &&
00977 isset($analyzed_sql[0]['querytype']) && $analyzed_sql[0]['querytype'] == 'SELECT' &&
00978 strlen($sql_query) > 200) {
00979
00980 $url_sql_query = 'SELECT ';
00981 if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
00982 $url_sql_query .= ' DISTINCT ';
00983 }
00984 $url_sql_query .= $analyzed_sql[0]['select_expr_clause'];
00985 if (!empty($analyzed_sql[0]['from_clause'])) {
00986 $url_sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
00987 }
00988 }
00989
00990 if (!is_array($map)) {
00991 $map = array();
00992 }
00993 ?>
00994 <!-- Results table body -->
00995 <?php
00996 echo "\n";
00997
00998 $row_no = 0;
00999 $vertical_display['edit'] = array();
01000 $vertical_display['delete'] = array();
01001 $vertical_display['data'] = array();
01002 $vertical_display['row_delete'] = array();
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025 while ($row = PMA_DBI_fetch_row($dt_result)) {
01026
01027 if (($row_no != 0) && ($repeat_cells != 0) && !($row_no % $repeat_cells) && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) {
01028 echo '<tr>' . "\n";
01029
01030 for ($foo_i = 0; $foo_i < $vertical_display['emptypre']; $foo_i++) {
01031 echo ' <th class="td"> </th>' . "\n";
01032 }
01033
01034 foreach ($vertical_display['desc'] AS $key => $val) {
01035 echo $val;
01036 }
01037
01038 for ($foo_i = 0; $foo_i < $vertical_display['emptyafter']; $foo_i++) {
01039 echo ' <th class="td"> </th>' . "\n";
01040 }
01041
01042 echo '</tr>' . "\n";
01043 }
01044
01045 if (isset($GLOBALS['printview']) && ($GLOBALS['printview'] == '1')) {
01046 $bgcolor = '#ffffff';
01047 } else {
01048 $bgcolor = ($row_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo'];
01049 }
01050
01051 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
01052
01053 $on_mouse = '';
01054 if (!isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1')) {
01055 if ($GLOBALS['cfg']['BrowsePointerEnable'] == TRUE) {
01056 $on_mouse = ' onmouseover="setPointer(this, ' . $row_no . ', \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'
01057 . ' onmouseout="setPointer(this, ' . $row_no . ', \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
01058 } else {
01059 $on_mouse = '';
01060 }
01061 if ($GLOBALS['cfg']['BrowseMarkerEnable'] == TRUE) {
01062 $on_mouse .= ' onmousedown="setPointer(this, ' . $row_no . ', \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
01063 }
01064 }
01065 ?>
01066 <tr<?php echo $on_mouse; ?>>
01067 <?php
01068 echo "\n";
01069 }
01070
01071
01072 if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') {
01073
01074
01075 if ($is_display['edit_lnk'] == 'ur' ) {
01076 $uva_condition = urlencode(PMA_getUvaCondition($dt_result, $fields_cnt, $fields_meta, $row));
01077 }
01078
01079
01080 $url_query = PMA_generate_common_url($db, $table)
01081 . '&pos=' . $pos
01082 . '&session_max_rows=' . $session_max_rows
01083 . '&disp_direction=' . $disp_direction
01084 . '&repeat_cells=' . $repeat_cells
01085 . '&dontlimitchars=' . $dontlimitchars;
01086
01087
01088 $propicon = (string)$GLOBALS['cfg']['PropertiesIconic'];
01089
01090 if ($propicon == 'both') {
01091 $iconic_spacer = '<div class="nowrap">';
01092 } else {
01093 $iconic_spacer = '';
01094 }
01095
01096
01097 if ($is_display['edit_lnk'] == 'ur') {
01098 $lnk_goto = 'sql.php';
01099
01100 $edit_url = 'tbl_change.php'
01101 . '?' . $url_query
01102 . '&primary_key=' . $uva_condition
01103 . '&sql_query=' . urlencode($url_sql_query)
01104 . '&goto=' . urlencode($lnk_goto);
01105 if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) {
01106 $edit_str = $GLOBALS['strEdit'];
01107 } else {
01108 $edit_str = $iconic_spacer . '<img width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_edit.png" alt="' . $GLOBALS['strEdit'] . '" title="' . $GLOBALS['strEdit'] . '" border="0" />';
01109 if ($propicon == 'both') {
01110 $edit_str .= ' ' . $GLOBALS['strEdit'] . '</div>';
01111 }
01112 }
01113 }
01114
01115 if ($table == $GLOBALS['cfg']['Bookmark']['table'] && $db == $GLOBALS['cfg']['Bookmark']['db'] && isset($row[1]) && isset($row[0])) {
01116 $bookmark_go = '<a href="read_dump.php?'
01117 . PMA_generate_common_url($row[1], '')
01118 . '&id_bookmark=' . $row[0]
01119 . '&action_bookmark=0'
01120 . '&action_bookmark_all=1'
01121 . '&SQL=' . $GLOBALS['strExecuteBookmarked']
01122 .' " title="' . $GLOBALS['strExecuteBookmarked'] . '">';
01123
01124 if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) {
01125 $bookmark_go .= $GLOBALS['strExecuteBookmarked'];
01126 } else {
01127 $bookmark_go .= $iconic_spacer . '<img width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_bookmark.png" alt="' . $GLOBALS['strExecuteBookmarked'] . '" title="' . $GLOBALS['strExecuteBookmarked'] . '" border="0" />';
01128 if ($propicon == 'both') {
01129 $bookmark_go .= ' ' . $GLOBALS['strExecuteBookmarked'] . '</div>';
01130 }
01131 }
01132
01133 $bookmark_go .= '</a>';
01134 } else {
01135 $bookmark_go = '';
01136 }
01137
01138
01139 if ($is_display['del_lnk'] == 'dr') {
01140 $lnk_goto = 'sql.php'
01141 . '?' . str_replace('&', '&', $url_query)
01142 . '&sql_query=' . urlencode($url_sql_query)
01143 . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
01144 . '&goto=' . (empty($goto) ? 'tbl_properties.php' : $goto);
01145 $del_query = urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $uva_condition . '+LIMIT+1';
01146 $del_url = 'sql.php'
01147 . '?' . $url_query
01148 . '&sql_query=' . $del_query
01149 . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
01150 . '&goto=' . urlencode($lnk_goto);
01151 $js_conf = 'DELETE FROM ' . PMA_jsFormat($table)
01152 . ' WHERE ' . trim(PMA_jsFormat(urldecode($uva_condition), FALSE))
01153 . ' LIMIT 1';
01154 if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) {
01155 $del_str = $GLOBALS['strDelete'];
01156 } else {
01157 $del_str = $iconic_spacer . '<img width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_drop.png" alt="' . $GLOBALS['strDelete'] . '" title="' . $GLOBALS['strDelete'] . '" border="0" />';
01158 if ($propicon == 'both') {
01159 $del_str .= ' ' . $GLOBALS['strDelete'] . '</div>';
01160 }
01161 }
01162 } else if ($is_display['del_lnk'] == 'kp') {
01163 $lnk_goto = 'sql.php'
01164 . '?' . str_replace('&', '&', $url_query)
01165 . '&sql_query=' . urlencode($url_sql_query)
01166 . '&goto=main.php';
01167 $del_url = 'sql.php?'
01168 . PMA_generate_common_url('mysql')
01169 . '&sql_query=' . urlencode('KILL ' . $row[0])
01170 . '&goto=' . urlencode($lnk_goto);
01171 $del_query = urlencode('KILL ' . $row[0]);
01172 $js_conf = 'KILL ' . $row[0];
01173 if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) {
01174 $del_str = $GLOBALS['strKill'];
01175 } else {
01176 $del_str = $iconic_spacer . '<img width="16" height="16" src="' . $GLOBALS['pmaThemeImage'] . 'b_drop.png" alt="' . $GLOBALS['strKill'] . '" title="' . $GLOBALS['strKill'] . '" border="0" />';
01177 if ($propicon == 'both') {
01178 $del_str .= ' ' . $GLOBALS['strKill'] . '</div>';
01179 }
01180 }
01181 }
01182
01183
01184 if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
01185 && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) {
01186 $doWriteModifyAt = 'left';
01187 require('./libraries/display_tbl_links.lib.php');
01188 }
01189 echo (($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') ? "\n" : '');
01190 }
01191
01192
01193 for ($i = 0; $i < $fields_cnt; ++$i) {
01194 $meta = $fields_meta[$i];
01195
01196
01197
01198 $pointer = (function_exists('is_null') ? $i : $meta->name);
01199
01200
01201 if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
01202 $column_style = 'style="border: 1px solid ' . $GLOBALS['cfg']['BrowseMarkerColor'] . '"';
01203 } else {
01204 $column_style = '';
01205 }
01206
01207 if ($disp_direction == 'vertical' && (!isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1'))) {
01208 if ($GLOBALS['cfg']['BrowsePointerColor'] == TRUE) {
01209 $column_style .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'
01210 . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
01211 }
01212 if ($GLOBALS['cfg']['BrowseMarkerEnable'] == TRUE) {
01213 $column_style .= ' onmousedown="setVerticalPointer(this, ' . $row_no . ', \'click\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\'); setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');"';
01214 } else {
01215 $column_style .= ' onmousedown="setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
01216 }
01217 } else {
01218 $column_style .= ' onmousedown="setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
01219 }
01220
01221
01222 $default_function = 'default_function';
01223 $transform_function = $default_function;
01224 $transform_options = array();
01225
01226 if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
01227
01228 if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) {
01229 $include_file = PMA_sanitizeTransformationFile($GLOBALS['mime_map'][$meta->name]['transformation']);
01230
01231 if (file_exists('./libraries/transformations/' . $include_file)) {
01232 $transformfunction_name = preg_replace('@(\.inc\.php3?)$@i', '', $GLOBALS['mime_map'][$meta->name]['transformation']);
01233
01234 require_once('./libraries/transformations/' . $include_file);
01235
01236 if (function_exists('PMA_transformation_' . $transformfunction_name)) {
01237 $transform_function = 'PMA_transformation_' . $transformfunction_name;
01238 $transform_options = PMA_transformation_getOptions((isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : ''));
01239 $meta->mimetype = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']);
01240 }
01241 }
01242 }
01243 }
01244
01245 $transform_options['wrapper_link'] = '?'
01246 . (isset($url_query) ? $url_query : '')
01247 . '&primary_key=' . (isset($uva_condition) ? $uva_condition : '')
01248 . '&sql_query=' . (isset($sql_query) ? urlencode($url_sql_query) : '')
01249 . '&goto=' . (isset($sql_goto) ? urlencode($lnk_goto) : '')
01250 . '&transform_key=' . urlencode($meta->name);
01251
01252
01253
01254 if ($meta->numeric == 1) {
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268 if (!isset($row[$i]) || is_null($row[$i])) {
01269 $vertical_display['data'][$row_no][$i] = ' <td align="right" valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
01270 } else if ($row[$i] != '') {
01271 $vertical_display['data'][$row_no][$i] = ' <td align="right" valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '" class="nowrap">';
01272
01273 if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
01274 foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
01275 $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
01276 if (!empty($alias)) {
01277 $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
01278 if ($alias == $meta->name) {
01279 $meta->name = $true_column;
01280 }
01281 }
01282 }
01283 }
01284
01285 if (isset($map[$meta->name])) {
01286
01287 if (!empty($map[$meta->name][2])) {
01288 $dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2])
01289 . ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
01290 . ' WHERE ' . PMA_backquote($map[$meta->name][1])
01291 . ' = ' . $row[$i];
01292 $dispresult = PMA_DBI_try_query($dispsql, NULL, PMA_DBI_QUERY_STORE);
01293 if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
01294 list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
01295 }
01296 else {
01297 $dispval = $GLOBALS['strLinkNotFound'];
01298 }
01299 @PMA_DBI_free_result($dispresult);
01300 }
01301 else {
01302 $dispval = '';
01303 }
01304
01305 if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
01306 $vertical_display['data'][$row_no][$i] .= ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta)) . ' <code>[->' . $dispval . ']</code>';
01307 } else {
01308 $title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : '';
01309
01310 $vertical_display['data'][$row_no][$i] .= '<a href="sql.php?'
01311 . PMA_generate_common_url($map[$meta->name][3], $map[$meta->name][0])
01312 . '&pos=0&session_max_rows=' . $session_max_rows . '&dontlimitchars=' . $dontlimitchars
01313 . '&sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = ' . $row[$i]) . '"' . $title . '>'
01314 . ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta)) . '</a>';
01315 }
01316 } else {
01317 $vertical_display['data'][$row_no][$i] .= ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta));
01318 }
01319 $vertical_display['data'][$row_no][$i] .= '</td>' . "\n";
01320 } else {
01321 $vertical_display['data'][$row_no][$i] = ' <td align="right" ' . $column_style . ' valign="top" bgcolor="' . $bgcolor . '" class="nowrap"> </td>' . "\n";
01322 }
01323
01324
01325
01326 } else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && stristr($meta->type, 'BLOB')) {
01327
01328
01329
01330
01331 $field_flags = PMA_DBI_field_flags($dt_result, $i);
01332 if (stristr($field_flags, 'BINARY')) {
01333 $blobtext = '[BLOB';
01334 if (!isset($row[$i]) || is_null($row[$i])) {
01335 $blobtext .= ' - NULL';
01336 } elseif (isset($row[$i])) {
01337 $blob_size = PMA_formatByteDown(strlen($row[$i]), 3, 1);
01338 $blobtext .= ' - '. $blob_size [0] . ' ' . $blob_size[1];
01339 unset($blob_size);
01340 }
01341
01342 $blobtext .= ']';
01343 $blobtext = ($default_function != $transform_function ? $transform_function($blobtext, $transform_options, $meta) : $default_function($blobtext, array(), $meta));
01344
01345 $vertical_display['data'][$row_no][$i] = ' <td align="center" ' . $column_style . ' valign="top" bgcolor="' . $bgcolor . '">' . $blobtext . '</td>';
01346 } else {
01347 if (!isset($row[$i]) || is_null($row[$i])) {
01348 $vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
01349 } else if ($row[$i] != '') {
01350
01351 if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) {
01352 $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
01353 }
01354
01355
01356 $row[$i] = ($default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta));
01357
01358 $vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '">' . $row[$i] . '</td>' . "\n";
01359 } else {
01360 $vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"> </td>' . "\n";
01361 }
01362 }
01363 } else {
01364 if (!isset($row[$i]) || is_null($row[$i])) {
01365 $vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
01366 } else if ($row[$i] != '') {
01367
01368 $relation_id = $row[$i];
01369
01370
01371 if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) {
01372 $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
01373 }
01374
01375
01376 $field_flags = PMA_DBI_field_flags($dt_result, $i);
01377 if (stristr($field_flags, 'BINARY')) {
01378 $row[$i] = str_replace("\x00", '\0', $row[$i]);
01379 $row[$i] = str_replace("\x08", '\b', $row[$i]);
01380 $row[$i] = str_replace("\x0a", '\n', $row[$i]);
01381 $row[$i] = str_replace("\x0d", '\r', $row[$i]);
01382 $row[$i] = str_replace("\x1a", '\Z', $row[$i]);
01383 $row[$i] = ($default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta));
01384 }
01385
01386
01387 else {
01388 $row[$i] = ($default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta));
01389 }
01390
01391
01392 $function_nowrap = $transform_function . '_nowrap';
01393 $bool_nowrap = (($default_function != $transform_function && function_exists($function_nowrap)) ? $function_nowrap($transform_options) : false);
01394
01395
01396 $nowrap = ((preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap) ? ' nowrap="nowrap"' : '');
01397 $vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"' . $nowrap . '>';
01398
01399 if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
01400 foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
01401 $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
01402 if (!empty($alias)) {
01403 $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
01404 if ($alias == $meta->name) {
01405 $meta->name = $true_column;
01406 }
01407 }
01408 }
01409 }
01410
01411 if (isset($map[$meta->name])) {
01412
01413 if (!empty($map[$meta->name][2])) {
01414 $dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2])
01415 . ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
01416 . ' WHERE ' . PMA_backquote($map[$meta->name][1])
01417 . ' = \'' . PMA_sqlAddslashes($row[$i]) . '\'';
01418 $dispresult = PMA_DBI_try_query($dispsql, NULL, PMA_DBI_QUERY_STORE);
01419 if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
01420 list($dispval) = PMA_DBI_fetch_row($dispresult);
01421 @PMA_DBI_free_result($dispresult);
01422 }
01423 else {
01424 $dispval = $GLOBALS['strLinkNotFound'];
01425 }
01426 }
01427 else {
01428 $dispval = '';
01429 }
01430 $title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : '';
01431
01432 $vertical_display['data'][$row_no][$i] .= '<a href="sql.php?'
01433 . PMA_generate_common_url($map[$meta->name][3], $map[$meta->name][0])
01434 . '&pos=0&session_max_rows=' . $session_max_rows . '&dontlimitchars=' . $dontlimitchars
01435 . '&sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = \'' . PMA_sqlAddslashes($relation_id) . '\'') . '"' . $title . '>'
01436 . $row[$i] . '</a>';
01437 } else {
01438 $vertical_display['data'][$row_no][$i] .= $row[$i];
01439 }
01440 $vertical_display['data'][$row_no][$i] .= '</td>' . "\n";
01441 } else {
01442 $vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"> </td>' . "\n";
01443 }
01444 }
01445
01446
01447 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
01448 echo $vertical_display['data'][$row_no][$i];
01449 }
01450
01451 if (isset($vertical_display['rowdata'][$i][$row_no])) {
01452 $vertical_display['rowdata'][$i][$row_no] .= $vertical_display['data'][$row_no][$i];
01453 } else {
01454 $vertical_display['rowdata'][$i][$row_no] = $vertical_display['data'][$row_no][$i];
01455 }
01456 }
01457
01458
01459 if ($GLOBALS['cfg']['ModifyDeleteAtRight']
01460 && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) {
01461 $doWriteModifyAt = 'right';
01462 require('./libraries/display_tbl_links.lib.php');
01463 }
01464
01465 if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
01466 echo "\n";
01467 ?>
01468 </tr>
01469 <?php
01470 }
01471
01472
01473
01474 if (!isset($vertical_display['edit'][$row_no])) {
01475 $vertical_display['edit'][$row_no] = '';
01476 $vertical_display['delete'][$row_no] = '';
01477 $vertical_display['row_delete'][$row_no] = '';
01478 }
01479
01480 $column_style_vertical = '';
01481 if ($GLOBALS['cfg']['BrowsePointerEnable'] == TRUE) {
01482 $column_style_vertical .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'
01483 . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
01484 }
01485 $column_marker_vertical = '';
01486 if ($GLOBALS['cfg']['BrowseMarkerEnable'] == TRUE) {
01487 $column_marker_vertical .= 'setVerticalPointer(this, ' . $row_no . ', \'click\', \'' . $GLOBALS['cfg']['BgcolorOne'] . '\', \'' . $GLOBALS['cfg']['BgcolorTwo'] . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');';
01488 }
01489
01490 if (!empty($del_url) && $is_display['del_lnk'] != 'kp') {
01491 $vertical_display['row_delete'][$row_no] .= ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '"' . $column_style_vertical . '>' . "\n"
01492 . ' <input type="checkbox" id="id_rows_to_delete' . $row_no . '[%_PMA_CHECKBOX_DIR_%]" name="rows_to_delete[' . $uva_condition . ']"'
01493 . ' onclick="' . $column_marker_vertical . 'copyCheckboxesRange(\'rowsDeleteForm\', \'id_rows_to_delete' . $row_no . '\',\'[%_PMA_CHECKBOX_DIR_%]\');"'
01494 . ' value="' . $del_query . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n"
01495 . ' </td>' . "\n";
01496 } else {
01497 unset($vertical_display['row_delete'][$row_no]);
01498 }
01499
01500 if (isset($edit_url)) {
01501 $vertical_display['edit'][$row_no] .= ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '"' . $column_style_vertical . '>' . "\n"
01502 . PMA_linkOrButton($edit_url, $edit_str, array(), FALSE)
01503 . $bookmark_go
01504 . ' </td>' . "\n";
01505 } else {
01506 unset($vertical_display['edit'][$row_no]);
01507 }
01508
01509 if (isset($del_url)) {
01510 $vertical_display['delete'][$row_no] .= ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '"' . $column_style_vertical . '>' . "\n"
01511 . PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''), FALSE)
01512 . ' </td>' . "\n";
01513 } else {
01514 unset($vertical_display['delete'][$row_no]);
01515 }
01516
01517 echo (($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') ? "\n" : '');
01518 $row_no++;
01519 }
01520
01521 if (isset($url_query)) {
01522 $GLOBALS['url_query'] = $url_query;
01523 }
01524
01525 return TRUE;
01526 }
01527
01528
01543 function PMA_displayVerticalTable()
01544 {
01545 global $vertical_display, $repeat_cells;
01546
01547
01548 if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) {
01549 echo '<tr>' . "\n";
01550 echo $vertical_display['textbtn'];
01551 $foo_counter = 0;
01552 foreach ($vertical_display['row_delete'] AS $key => $val) {
01553 if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01554 echo '<th class="td"> </th>' . "\n";
01555 }
01556
01557 echo str_replace('[%_PMA_CHECKBOX_DIR_%]', '', $val);
01558 $foo_counter++;
01559 }
01560 echo '</tr>' . "\n";
01561 }
01562
01563
01564 if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['edit']) && (count($vertical_display['edit']) > 0 || !empty($vertical_display['textbtn']))) {
01565 echo '<tr>' . "\n";
01566 if (!is_array($vertical_display['row_delete'])) {
01567 echo $vertical_display['textbtn'];
01568 }
01569 $foo_counter = 0;
01570 foreach ($vertical_display['edit'] AS $key => $val) {
01571 if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01572 echo ' <th class="td"> </th>' . "\n";
01573 }
01574
01575 echo $val;
01576 $foo_counter++;
01577 }
01578 echo '</tr>' . "\n";
01579 }
01580
01581
01582 if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['delete']) && (count($vertical_display['delete']) > 0 || !empty($vertical_display['textbtn']))) {
01583 echo '<tr>' . "\n";
01584 if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) {
01585 echo $vertical_display['textbtn'];
01586 }
01587 $foo_counter = 0;
01588 foreach ($vertical_display['delete'] AS $key => $val) {
01589 if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01590 echo '<th class="td"> </th>' . "\n";
01591 }
01592
01593 echo $val;
01594 $foo_counter++;
01595 }
01596 echo '</tr>' . "\n";
01597 }
01598
01599
01600 $row_no = 0;
01601 foreach ($vertical_display['desc'] AS $key => $val) {
01602 $row_no++;
01603
01604 if (isset($GLOBALS['printview']) && ($GLOBALS['printview'] == '1')) {
01605 $bgcolor = '#ffffff';
01606 } else {
01607 $bgcolor = ($row_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo'];
01608 }
01609
01610 echo '<tr>' . "\n";
01611 echo $val;
01612
01613 $foo_counter = 0;
01614 foreach ($vertical_display['rowdata'][$key] AS $subkey => $subval) {
01615 if (($foo_counter != 0) && ($repeat_cells != 0) and !($foo_counter % $repeat_cells)) {
01616 echo $val;
01617 }
01618
01619 echo $subval;
01620 $foo_counter++;
01621 }
01622
01623 echo '</tr>' . "\n";
01624 }
01625
01626
01627 if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) {
01628 echo '<tr>' . "\n";
01629 echo $vertical_display['textbtn'];
01630 $foo_counter = 0;
01631 foreach ($vertical_display['row_delete'] AS $key => $val) {
01632 if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01633 echo '<th class="td"> </th>' . "\n";
01634 }
01635
01636 echo str_replace('[%_PMA_CHECKBOX_DIR_%]', 'r', $val);
01637 $foo_counter++;
01638 }
01639 echo '</tr>' . "\n";
01640 }
01641
01642
01643 if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['edit']) && (count($vertical_display['edit']) > 0 || !empty($vertical_display['textbtn']))) {
01644 echo '<tr>' . "\n";
01645 if (!is_array($vertical_display['row_delete'])) {
01646 echo $vertical_display['textbtn'];
01647 }
01648 $foo_counter = 0;
01649 foreach ($vertical_display['edit'] AS $key => $val) {
01650 if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01651 echo '<th class="td"> </th>' . "\n";
01652 }
01653
01654 echo $val;
01655 $foo_counter++;
01656 }
01657 echo '</tr>' . "\n";
01658 }
01659
01660
01661 if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['delete']) && (count($vertical_display['delete']) > 0 || !empty($vertical_display['textbtn']))) {
01662 echo '<tr>' . "\n";
01663 if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) {
01664 echo $vertical_display['textbtn'];
01665 }
01666 $foo_counter = 0;
01667 foreach ($vertical_display['delete'] AS $key => $val) {
01668 if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
01669 echo '<th class="td"> </th>' . "\n";
01670 }
01671
01672 echo $val;
01673 $foo_counter++;
01674 }
01675 echo '</tr>' . "\n";
01676 }
01677
01678 return TRUE;
01679 }
01680
01681
01722 function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
01723 {
01724 global $db, $table, $goto, $dontlimitchars;
01725 global $sql_query, $num_rows, $unlim_num_rows, $pos, $fields_meta, $fields_cnt;
01726 global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns;
01727 global $cfgRelation;
01728
01729
01730
01731
01732
01733 $total = '';
01734 $is_display = PMA_setDisplayMode($the_disp_mode, $total);
01735 if ($total == '') {
01736 unset($total);
01737 }
01738
01739
01740 if ($is_display['nav_bar'] == '1') {
01741 if (!isset($pos)) {
01742 $pos = 0;
01743 }
01744 if ($GLOBALS['session_max_rows'] == 'all') {
01745 $pos_next = 0;
01746 $pos_prev = 0;
01747 } else {
01748 $pos_next = $pos + $GLOBALS['cfg']['MaxRows'];
01749 $pos_prev = $pos - $GLOBALS['cfg']['MaxRows'];
01750 if ($pos_prev < 0) {
01751 $pos_prev = 0;
01752 }
01753 }
01754 }
01755
01756
01757 $encoded_sql_query = urlencode($sql_query);
01758
01759
01760
01761
01762 if ($is_display['nav_bar'] == '1' && isset($pos_next)) {
01763 if (isset($unlim_num_rows) && $unlim_num_rows != $total) {
01764 $selectstring = ', ' . $unlim_num_rows . ' ' . $GLOBALS['strSelectNumRows'];
01765 } else {
01766 $selectstring = '';
01767 }
01768 $last_shown_rec = ($GLOBALS['session_max_rows'] == 'all' || $pos_next > $total)
01769 ? $total - 1
01770 : $pos_next - 1;
01771 PMA_showMessage($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec ($total " . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')');
01772 } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
01773 PMA_showMessage($GLOBALS['strSQLQuery']);
01774 }
01775
01776
01777 if (!isset($table) || strlen(trim($table)) == 0) {
01778
01779
01780
01781 if ($fields_meta[0]->table == 'TABLES') {
01782 $table = '';
01783 } else {
01784 $table = $fields_meta[0]->table;
01785 }
01786 }
01787 if ($is_display['nav_bar'] == '1') {
01788 PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
01789 echo "\n";
01790 } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
01791 echo "\n" . '<br /><br />' . "\n";
01792 }
01793
01794
01795
01796
01797
01798
01799 $map = array();
01800
01801
01802
01803 $target=array();
01804 if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
01805 foreach ($analyzed_sql[0]['table_ref'] AS $table_ref_position => $table_ref) {
01806 $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
01807 }
01808 }
01809 $tabs = '(\'' . join('\',\'', $target) . '\')';
01810
01811 if ($cfgRelation['displaywork']) {
01812 if (empty($table)) {
01813 $exist_rel = FALSE;
01814 } else {
01815 $exist_rel = PMA_getForeigners($db, $table, '', 'both');
01816 if ($exist_rel) {
01817 foreach ($exist_rel AS $master_field => $rel) {
01818 $display_field = PMA_getDisplayField($rel['foreign_db'],$rel['foreign_table']);
01819 $map[$master_field] = array($rel['foreign_table'],
01820 $rel['foreign_field'],
01821 $display_field,
01822 $rel['foreign_db']);
01823 }
01824 }
01825 }
01826 }
01827
01828
01829
01830 PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql);
01831 $url_query='';
01832 PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql);
01833
01834 if ($disp_direction == 'vertical') {
01835 PMA_displayVerticalTable();
01836 }
01837 unset($vertical_display);
01838 ?>
01839 </table>
01840 <?php
01841
01842 echo "\n";
01843
01844
01845
01846 if ($is_display['del_lnk'] == 'dr' && $is_display['del_lnk'] != 'kp') {
01847
01848 $delete_text = $is_display['del_lnk'] == 'dr' ? $GLOBALS['strDelete'] : $GLOBALS['strKill'];
01849 $propicon = (string)$GLOBALS['cfg']['PropertiesIconic'];
01850
01851 $uncheckall_url = 'sql.php?'
01852 . PMA_generate_common_url($db, $table)
01853 . '&sql_query=' . urlencode($sql_query)
01854 . '&pos=' . $pos
01855 . '&session_max_rows=' . $GLOBALS['session_max_rows']
01856 . '&pos=' . $pos
01857 . '&disp_direction=' . $disp_direction
01858 . '&repeat_cells=' . $repeat_cells
01859 . '&goto=' . $goto
01860 . '&dontlimitchars=' . $dontlimitchars;
01861 $checkall_url = $uncheckall_url . '&checkall=1';
01862 $checkall_params['onclick'] = 'setCheckboxesRange(\'rowsDeleteForm\', true, \'id_rows_to_delete\', 0, ' . $num_rows . '); return false;';
01863 $uncheckall_params['onclick'] = 'setCheckboxesRange(\'rowsDeleteForm\', false, \'id_rows_to_delete\', 0, ' . $num_rows . '); return false;';
01864 $checkall_link = PMA_linkOrButton( $checkall_url, $GLOBALS['strCheckAll'], $checkall_params, false );
01865 $uncheckall_link = PMA_linkOrButton( $uncheckall_url, $GLOBALS['strUncheckAll'], $uncheckall_params, false );
01866 ?>
01867 <img src="<?php echo $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png'; ?>" border="0" width="38" height="22" alt="<?php echo $GLOBALS['strWithChecked']; ?>" />
01868 <?php echo $checkall_link; ?>
01869 /
01870 <?php echo $uncheckall_link; ?>
01871 <?php
01872 echo ' <i>' . $GLOBALS['strWithChecked'] . '</i>'. "\n";
01873
01874 if ($GLOBALS['cfg']['PropertiesIconic']) {
01875 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', $GLOBALS['strChange'], 'b_edit.png');
01876 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_delete', $delete_text, 'b_drop.png');
01877 if ($analyzed_sql[0]['querytype'] == 'SELECT') {
01878 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_export', $GLOBALS['strExport'], 'b_tblexport.png');
01879 }
01880 echo "\n";
01881 } else {
01882 echo ' <input type="submit" name="submit_mult" value="' . htmlspecialchars($GLOBALS['strEdit']) . '" title="' . $GLOBALS['strEdit'] . '" />' . "\n";
01883 echo ' <input type="submit" name="submit_mult" value="' . htmlspecialchars($delete_text) . '" title="' . $delete_text . '" />' . "\n";
01884 if ($analyzed_sql[0]['querytype'] == 'SELECT') {
01885 echo ' <input type="submit" name="submit_mult" value="' . htmlspecialchars($GLOBALS['strExport']) . '" title="' . $GLOBALS['strExport'] . '" />' . "\n";
01886 }
01887 }
01888 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
01889 echo '<input type="hidden" name="pos" value="' . $pos . '" />' . "\n";
01890 echo '<input type="hidden" name="url_query" value="' . $GLOBALS['url_query'] . '" />' . "\n";
01891 echo '<br />' . "\n";
01892 echo '</form>' . "\n";
01893 }
01894
01895
01896
01897 if ($is_display['nav_bar'] == '1') {
01898 echo '<br />' . "\n";
01899 PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
01900 } else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
01901 echo "\n" . '<br /><br />' . "\n";
01902 }
01903 }
01904
01905 function default_function($buffer) {
01906 $buffer = htmlspecialchars($buffer);
01907 $buffer = str_replace("\011", ' ', str_replace(' ', ' ', $buffer));
01908 $buffer = preg_replace("@((\015\012)|(\015)|(\012))@", '<br />', $buffer);
01909
01910 return $buffer;
01911 }
01912 ?>