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