' . "\n";
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
echo '' . "\n";
}
// 1. Displays the full/partial text button (part 1)...
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
$colspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
? ' colspan="3"'
: '';
} else {
$rowspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
? ' rowspan="3"'
: '';
}
$url_params = array(
'db' => $db,
'table' => $table,
'sql_query' => $sql_query,
'goto' => $goto,
);
$text_message = '
>
' . "\n"
. ' ' . $text_link . "\n"
. ' ' . "\n";
} // end vertical mode
}
// ... elseif no button, displays empty(ies) col(s) if required
elseif ($GLOBALS['cfg']['ModifyDeleteAtLeft']
&& ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) {
$vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 0;
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
?>
>
' . "\n";
} // end vertical mode
}
// 2. Displays the fields' name
// 2.0 If sorting links should be used, checks if the query is a "JOIN"
// statement (see 2.1.3)
// 2.0.1 Prepare Display column comments if enabled ($GLOBALS['cfg']['ShowBrowseComments']).
// Do not show comments, if using horizontalflipped mode, because of space usage
if ($GLOBALS['cfg']['ShowBrowseComments']
&& ($GLOBALS['cfgRelation']['commwork']
|| PMA_MYSQL_INT_VERSION >= 40100)
&& $_SESSION['userconf']['disp_direction'] != 'horizontalflipped') {
$comments_map = array();
if (isset($analyzed_sql[0]) && is_array($analyzed_sql[0])) {
foreach ($analyzed_sql[0]['table_ref'] as $tbl) {
$tb = $tbl['table_true_name'];
$comments_map[$tb] = PMA_getComments($db, $tb);
unset($tb);
}
}
}
if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
require_once './libraries/transformations.lib.php';
$GLOBALS['mime_map'] = PMA_getMIME($db, $table);
}
if ($is_display['sort_lnk'] == '1') {
//$is_join = preg_match('@(.*)[[:space:]]+FROM[[:space:]]+.*[[:space:]]+JOIN@im', $sql_query, $select_stt);
$is_join = (isset($analyzed_sql[0]['queryflags']['join']) ? true : false);
$select_expr = $analyzed_sql[0]['select_expr_clause'];
} else {
$is_join = false;
}
// garvin: See if we have to highlight any header fields of a WHERE query.
// Uses SQL-Parser results.
$highlight_columns = array();
if (isset($analyzed_sql) && isset($analyzed_sql[0]) &&
isset($analyzed_sql[0]['where_clause_identifiers'])) {
$wi = 0;
if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) {
foreach ($analyzed_sql[0]['where_clause_identifiers'] AS $wci_nr => $wci) {
$highlight_columns[$wci] = 'true';
}
}
}
for ($i = 0; $i < $fields_cnt; $i++) {
// garvin: See if this column should get highlight because it's used in the
// where-query.
if (isset($highlight_columns[$fields_meta[$i]->name]) || isset($highlight_columns[PMA_backquote($fields_meta[$i]->name)])) {
$condition_field = true;
} else {
$condition_field = false;
}
// 2.0 Prepare comment-HTML-wrappers for each row, if defined/enabled.
if (isset($comments_map) &&
isset($comments_map[$fields_meta[$i]->table]) &&
isset($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name])) {
$comments = '';
} else {
$comments = '';
}
// 2.1 Results can be sorted
if ($is_display['sort_lnk'] == '1') {
// 2.1.1 Checks if the table name is required; it's the case
// for a query with a "JOIN" statement and if the column
// isn't aliased, or in queries like
// SELECT `1`.`master_field` , `2`.`master_field`
// FROM `PMA_relation` AS `1` , `PMA_relation` AS `2`
/**
* we prefer always using table if existing
* and second this code does not correctly check $fields_meta[$i]->table
if (($is_join
&& !preg_match('~([^[:space:],]|`[^`]`)[[:space:]]+(as[[:space:]]+)?' . strtr($fields_meta[$i]->name, array('[' => '\\[', '~' => '\\~', '\\' => '\\\\')) . '~i', $select_expr, $parts))
|| (isset($analyzed_sql[0]['select_expr'][$i]['expr'])
&& isset($analyzed_sql[0]['select_expr'][$i]['column'])
&& $analyzed_sql[0]['select_expr'][$i]['expr'] !=
$analyzed_sql[0]['select_expr'][$i]['column']
&& isset($fields_meta[$i]->table) && strlen($fields_meta[$i]->table))) {
*/
if (isset($fields_meta[$i]->table) && strlen($fields_meta[$i]->table)) {
$sort_tbl = PMA_backquote($fields_meta[$i]->table) . '.';
} else {
$sort_tbl = '';
}
// 2.1.2 Checks if the current column is used to sort the
// results
if (empty($sort_expression)) {
$is_in_sort = false;
} else {
// field name may be preceded by a space, or any number
// of characters followed by a dot (tablename.fieldname)
// so do a direct comparison
// for the sort expression (avoids problems with queries
// like "SELECT id, count(id)..." and clicking to sort
// on id or on count(id))
$is_in_sort = ($sort_tbl . PMA_backquote($fields_meta[$i]->name) == $sort_expression_nodir ? true : false);
}
// 2.1.3 Check the field name for backquotes.
// If it contains some, it's probably a function column
// like 'COUNT(`field`)'
if (strpos($fields_meta[$i]->name, '`') !== false) {
$sort_order = ' ORDER BY ' . PMA_backquote($fields_meta[$i]->name) . ' ';
} else {
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ';
}
// 2.1.4 Do define the sorting URL
if (! $is_in_sort) {
// loic1: patch #455484 ("Smart" order)
$GLOBALS['cfg']['Order'] = strtoupper($GLOBALS['cfg']['Order']);
if ($GLOBALS['cfg']['Order'] === 'SMART') {
$sort_order .= (preg_match('@time|date@i', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
} else {
$sort_order .= $GLOBALS['cfg']['Order'];
}
$order_img = '';
} elseif (preg_match('@[[:space:]]DESC$@i', $sort_expression)) {
$sort_order .= ' ASC';
$order_img = ' ';
} else {
$sort_order .= ' DESC';
$order_img = ' ';
}
if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@i', $unsorted_sql_query, $regs3)) {
$sorted_sql_query = $regs3[1] . $sort_order . $regs3[2];
} else {
$sorted_sql_query = $unsorted_sql_query . $sort_order;
}
$url_query = PMA_generate_common_url($db, $table)
. '&sql_query=' . urlencode($sorted_sql_query);
$order_url = 'sql.php?' . $url_query;
// 2.1.5 Displays the sorting URL
// added 20004-06-09: Michael Keck
// enable sort order swapping for image
$order_link_params = array();
if (isset($order_img) && $order_img!='') {
if (strstr($order_img, 'asc')) {
$order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
$order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
} elseif (strstr($order_img, 'desc')) {
$order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
$order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
}
}
if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped'
&& $GLOBALS['cfg']['HeaderFlipType'] == 'css') {
$order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;';
}
$order_link_params['title'] = $GLOBALS['strSort'];
$order_link_content = ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), " \n") : htmlspecialchars($fields_meta[$i]->name));
$order_link = PMA_linkOrButton($order_url, $order_link_content . $order_img, $order_link_params, false, true);
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
echo '' . $order_link . $comments . ' ';
}
$vertical_display['desc'][] = ' ' . "\n"
. $order_link . $comments . ' ' . "\n";
} // end if (2.1)
// 2.2 Results can't be sorted
else {
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
echo '';
if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped'
&& $GLOBALS['cfg']['HeaderFlipType'] == 'fake') {
echo PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), ' ');
} else {
echo htmlspecialchars($fields_meta[$i]->name);
}
echo "\n" . $comments . ' ';
}
$vertical_display['desc'][] = ' ' . "\n"
. ' ' . htmlspecialchars($fields_meta[$i]->name) . "\n"
. $comments . ' ';
} // end else (2.2)
} // end for
// 3. Displays the full/partial text button (part 2) at the right
// column of the result table header if possible and required...
if ($GLOBALS['cfg']['ModifyDeleteAtRight']
&& ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')
&& $is_display['text_btn'] == '1') {
$vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1;
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
echo "\n";
?>
>
' . "\n"
. ' ' . $text_link . "\n"
. ' ' . "\n";
} // end vertical mode
}
// ... elseif no button, displays empty columns if required
// (unless coming from Browse mode print view)
elseif ($GLOBALS['cfg']['ModifyDeleteAtRight']
&& ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
&& (!$GLOBALS['is_header_sent'])) {
$vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1;
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
echo "\n";
?>
>
' . "\n";
} // end vertical mode
}
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
?>
200) {
$url_sql_query = 'SELECT ';
if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
$url_sql_query .= ' DISTINCT ';
}
$url_sql_query .= $analyzed_sql[0]['select_expr_clause'];
if (!empty($analyzed_sql[0]['from_clause'])) {
$url_sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
}
}
if (!is_array($map)) {
$map = array();
}
$row_no = 0;
$vertical_display['edit'] = array();
$vertical_display['delete'] = array();
$vertical_display['data'] = array();
$vertical_display['row_delete'] = array();
// Correction University of Virginia 19991216 in the while below
// Previous code assumed that all tables have keys, specifically that
// the phpMyAdmin GUI should support row delete/edit only for such
// tables.
// Although always using keys is arguably the prescribed way of
// defining a relational table, it is not required. This will in
// particular be violated by the novice.
// We want to encourage phpMyAdmin usage by such novices. So the code
// below has been changed to conditionally work as before when the
// table being displayed has one or more keys; but to display
// delete/edit options correctly for tables without keys.
// loic1: use 'PMA_mysql_fetch_array' rather than 'PMA_mysql_fetch_row'
// to get the NULL values
// rabus: This function needs a little rework.
// Using MYSQL_BOTH just pollutes the memory!
// ne0x: Use function PMA_DBI_fetch_array() due to mysqli
// compatibility. Now this function is wrapped.
$odd_row = true;
while ($row = PMA_DBI_fetch_row($dt_result)) {
// lem9: "vertical display" mode stuff
if ($row_no != 0 && $_SESSION['userconf']['repeat_cells'] != 0 && !($row_no % $_SESSION['userconf']['repeat_cells'])
&& ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped'))
{
echo '' . "\n";
if ($vertical_display['emptypre'] > 0) {
echo ' ' . "\n"
.' ' . "\n";
}
foreach ($vertical_display['desc'] as $val) {
echo $val;
}
if ($vertical_display['emptyafter'] > 0) {
echo ' ' . "\n"
.' ' . "\n";
}
echo ' ' . "\n";
} // end if
$class = $odd_row ? 'odd' : 'even';
$odd_row = ! $odd_row;
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
// loic1: pointer code part
echo ' ' . "\n";
$class = '';
}
// 1. Prepares the row (gets primary keys to use)
// 1.1 Results from a "SELECT" statement -> builds the
// "primary" key to use in links
/**
* @todo $unique_condition could be empty, for example a table
* with only one field and it's a BLOB; in this case,
* avoid to display the delete and edit links
*/
$unique_condition = urlencode(PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row));
// 1.2 Defines the URLs for the modify/delete link(s)
$url_query = PMA_generate_common_url($db, $table);
if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') {
// We need to copy the value or else the == 'both' check will always return true
if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
$iconic_spacer = '';
} else {
$iconic_spacer = '';
}
// 1.2.1 Modify link(s)
if ($is_display['edit_lnk'] == 'ur') { // update row case
$lnk_goto = 'sql.php';
$edit_url = 'tbl_change.php'
. '?' . $url_query
. '&primary_key=' . $unique_condition
. '&sql_query=' . urlencode($url_sql_query)
. '&goto=' . urlencode($lnk_goto);
if ($GLOBALS['cfg']['PropertiesIconic'] === false) {
$edit_str = $GLOBALS['strEdit'];
} else {
$edit_str = $iconic_spacer . '
';
if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
$edit_str .= ' ' . $GLOBALS['strEdit'] . '
';
}
}
} // end if (1.2.1)
if (isset($GLOBALS['cfg']['Bookmark']['table']) && isset($GLOBALS['cfg']['Bookmark']['db']) && $table == $GLOBALS['cfg']['Bookmark']['table'] && $db == $GLOBALS['cfg']['Bookmark']['db'] && isset($row[1]) && isset($row[0])) {
$bookmark_go = '';
if ($GLOBALS['cfg']['PropertiesIconic'] === false) {
$bookmark_go .= $GLOBALS['strExecuteBookmarked'];
} else {
$bookmark_go .= $iconic_spacer . ' ';
if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
$bookmark_go .= ' ' . $GLOBALS['strExecuteBookmarked'] . '';
}
}
$bookmark_go .= ' ';
} else {
$bookmark_go = '';
}
// 1.2.2 Delete/Kill link(s)
if ($is_display['del_lnk'] == 'dr') { // delete row case
$lnk_goto = 'sql.php'
. '?' . str_replace('&', '&', $url_query)
. '&sql_query=' . urlencode($url_sql_query)
. '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
. '&goto=' . (empty($goto) ? 'tbl_sql.php' : $goto);
$del_query = urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $unique_condition . '+LIMIT+1';
$del_url = 'sql.php'
. '?' . $url_query
. '&sql_query=' . $del_query
. '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
. '&goto=' . urlencode($lnk_goto);
$js_conf = 'DELETE FROM ' . PMA_jsFormat($table)
. ' WHERE ' . trim(PMA_jsFormat(urldecode($unique_condition), false))
. ' LIMIT 1';
if ($GLOBALS['cfg']['PropertiesIconic'] === false) {
$del_str = $GLOBALS['strDelete'];
} else {
$del_str = $iconic_spacer . ' ';
if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
$del_str .= ' ' . $GLOBALS['strDelete'] . '';
}
}
} elseif ($is_display['del_lnk'] == 'kp') { // kill process case
$lnk_goto = 'sql.php'
. '?' . str_replace('&', '&', $url_query)
. '&sql_query=' . urlencode($url_sql_query)
. '&goto=main.php';
$del_url = 'sql.php?'
. PMA_generate_common_url('mysql')
. '&sql_query=' . urlencode('KILL ' . $row[0])
. '&goto=' . urlencode($lnk_goto);
$del_query = urlencode('KILL ' . $row[0]);
$js_conf = 'KILL ' . $row[0];
if ($GLOBALS['cfg']['PropertiesIconic'] === false) {
$del_str = $GLOBALS['strKill'];
} else {
$del_str = $iconic_spacer . ' ';
if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
$del_str .= ' ' . $GLOBALS['strKill'] . '';
}
}
} // end if (1.2.2)
// 1.3 Displays the links at left if required
if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
&& ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped')) {
$doWriteModifyAt = 'left';
require './libraries/display_tbl_links.lib.php';
} // end if (1.3)
} // end if (1)
// 2. Displays the rows' values
for ($i = 0; $i < $fields_cnt; ++$i) {
$meta = $fields_meta[$i];
// loic1: To fix bug #474943 under php4, the row pointer will
// depend on whether the "is_null" php4 function is
// available or not
$pointer = (function_exists('is_null') ? $i : $meta->name);
// garvin: See if this column should get highlight because it's used in the
// where-query.
if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
$condition_field = true;
} else {
$condition_field = false;
}
$mouse_events = '';
if ($_SESSION['userconf']['disp_direction'] == 'vertical' && (!isset($GLOBALS['printview']) || ($GLOBALS['printview'] != '1'))) {
if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
$mouse_events .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'odd\', \'even\', \'hover\', \'marked\');"'
. ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'odd\', \'even\', \'hover\', \'marked\');" ';
}
if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
$mouse_events .= ' onmousedown="setVerticalPointer(this, ' . $row_no . ', \'click\', \'odd\', \'even\', \'hover\', \'marked\'); setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
} else {
$mouse_events .= ' onmousedown="setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
}
}// end if
// garvin: Wrap MIME-transformations. [MIME]
$default_function = 'default_function'; // default_function
$transform_function = $default_function;
$transform_options = array();
if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) {
$include_file = PMA_sanitizeTransformationFile($GLOBALS['mime_map'][$meta->name]['transformation']);
if (file_exists('./libraries/transformations/' . $include_file)) {
$transformfunction_name = preg_replace('@(\.inc\.php3?)$@i', '', $GLOBALS['mime_map'][$meta->name]['transformation']);
require_once './libraries/transformations/' . $include_file;
if (function_exists('PMA_transformation_' . $transformfunction_name)) {
$transform_function = 'PMA_transformation_' . $transformfunction_name;
$transform_options = PMA_transformation_getOptions((isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : ''));
$meta->mimetype = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']);
}
} // end if file_exists
} // end if transformation is set
} // end if mime/transformation works.
$transform_options['wrapper_link'] = '?'
. (isset($url_query) ? $url_query : '')
. '&primary_key=' . (isset($unique_condition) ? $unique_condition : '')
. '&sql_query=' . (empty($sql_query) ? '' : urlencode($url_sql_query))
. '&goto=' . (isset($sql_goto) ? urlencode($lnk_goto) : '')
. '&transform_key=' . urlencode($meta->name);
// n u m e r i c
if ($meta->numeric == 1) {
// lem9: if two fields have the same name (this is possible
// with self-join queries, for example), using $meta->name
// will show both fields NULL even if only one is NULL,
// so use the $pointer
// (works only if function_exists('is_null')
// PS: why not always work with the number ($i), since
// the default second parameter of
// mysql_fetch_array() is MYSQL_BOTH, so we always get
// associative and numeric indices?
//if (!isset($row[$meta->name])
if (!isset($row[$i]) || is_null($row[$i])) {
$vertical_display['data'][$row_no][$i] = ' NULL ' . "\n";
} elseif ($row[$i] != '') {
$vertical_display['data'][$row_no][$i] = ' ';
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
if (isset($alias) && strlen($alias)) {
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
if ($alias == $meta->name) {
$meta->name = $true_column;
} // end if
} // end if
} // end while
}
if (isset($map[$meta->name])) {
// Field to display from the foreign table?
if (isset($map[$meta->name][2]) && strlen($map[$meta->name][2])) {
$dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2])
. ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
. ' WHERE ' . PMA_backquote($map[$meta->name][1])
. ' = ' . $row[$i];
$dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE);
if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
} else {
$dispval = $GLOBALS['strLinkNotFound'];
}
@PMA_DBI_free_result($dispresult);
} else {
$dispval = '';
} // end if... else...
if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
$vertical_display['data'][$row_no][$i] .= ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta)) . ' [->' . $dispval . ']
';
} else {
$title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : '';
$vertical_display['data'][$row_no][$i] .= ''
. ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta)) . ' ';
}
} else {
$vertical_display['data'][$row_no][$i] .= ($transform_function != $default_function ? $transform_function($row[$i], $transform_options, $meta) : $transform_function($row[$i], array(), $meta));
}
$vertical_display['data'][$row_no][$i] .= ' ' . "\n";
} else {
$vertical_display['data'][$row_no][$i] = ' ' . "\n";
}
// b l o b
} elseif ($GLOBALS['cfg']['ShowBlob'] == false && stristr($meta->type, 'BLOB')) {
// loic1 : PMA_mysql_fetch_fields returns BLOB in place of
// TEXT fields type, however TEXT fields must be displayed
// even if $GLOBALS['cfg']['ShowBlob'] is false -> get the true type
// of the fields.
$field_flags = PMA_DBI_field_flags($dt_result, $i);
if (stristr($field_flags, 'BINARY')) {
$blobtext = '[BLOB';
if (!isset($row[$i]) || is_null($row[$i])) {
$blobtext .= ' - NULL';
$blob_size = 0;
} elseif (isset($row[$i])) {
$blob_size = strlen($row[$i]);
$display_blob_size = PMA_formatByteDown($blob_size, 3, 1);
$blobtext .= ' - '. $display_blob_size[0] . ' ' . $display_blob_size[1];
unset($display_blob_size);
}
$blobtext .= ']';
if (strpos($transform_function, 'octetstream')) {
$blobtext = $row[$i];
}
if ($blob_size > 0) {
$blobtext = ($default_function != $transform_function ? $transform_function($blobtext, $transform_options, $meta) : $default_function($blobtext, array(), $meta));
}
unset($blob_size);
$vertical_display['data'][$row_no][$i] = ' ' . $blobtext . ' ';
} else {
if (!isset($row[$i]) || is_null($row[$i])) {
$vertical_display['data'][$row_no][$i] = ' NULL ' . "\n";
} elseif ($row[$i] != '') {
// garvin: if a transform function for blob is set, none of these replacements will be made
if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ! $_SESSION['userconf']['dontlimitchars']) {
$row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
}
// loic1: displays all space characters, 4 space
// characters for tabulations and /
$row[$i] = ($default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta));
$vertical_display['data'][$row_no][$i] = ' ' . $row[$i] . ' ' . "\n";
} else {
$vertical_display['data'][$row_no][$i] = ' ' . "\n";
}
}
} else {
if (!isset($row[$i]) || is_null($row[$i])) {
$vertical_display['data'][$row_no][$i] = ' NULL ' . "\n";
} elseif ($row[$i] != '') {
// loic1: support blanks in the key
$relation_id = $row[$i];
// nijel: Cut all fields to $GLOBALS['cfg']['LimitChars']
// lem9: (unless it's a link-type transformation)
if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ! $_SESSION['userconf']['dontlimitchars'] && !strpos($transform_function, 'link') === true) {
$row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
}
// loic1: displays special characters from binaries
$field_flags = PMA_DBI_field_flags($dt_result, $i);
if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) {
$db_value = $row[$i];
$row[$i] = '';
for ($j = 0; $j < ceil($meta->length / 8); $j++) {
$row[$i] .= sprintf('%08d', decbin(ord(substr($db_value, $j, 1))));
}
$row[$i] = substr($row[$i], -$meta->length);
} elseif (stristr($field_flags, 'BINARY')) {
$row[$i] = str_replace("\x00", '\0', $row[$i]);
$row[$i] = str_replace("\x08", '\b', $row[$i]);
$row[$i] = str_replace("\x0a", '\n', $row[$i]);
$row[$i] = str_replace("\x0d", '\r', $row[$i]);
$row[$i] = str_replace("\x1a", '\Z', $row[$i]);
$row[$i] = ($default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta));
}
// loic1: displays all space characters, 4 space
// characters for tabulations and /
else {
$row[$i] = ($default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta));
}
// garvin: transform functions may enable no-wrapping:
$function_nowrap = $transform_function . '_nowrap';
$bool_nowrap = (($default_function != $transform_function && function_exists($function_nowrap)) ? $function_nowrap($transform_options) : false);
// loic1: do not wrap if date field type
$nowrap = ((preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap) ? ' nowrap' : '');
$vertical_display['data'][$row_no][$i] = ' ';
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
if (isset($alias) && strlen($alias)) {
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
if ($alias == $meta->name) {
$meta->name = $true_column;
} // end if
} // end if
} // end while
}
if (isset($map[$meta->name])) {
// Field to display from the foreign table?
if (isset($map[$meta->name][2]) && strlen($map[$meta->name][2])) {
$dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2])
. ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
. ' WHERE ' . PMA_backquote($map[$meta->name][1])
. ' = \'' . PMA_sqlAddslashes($row[$i]) . '\'';
$dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE);
if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
list($dispval) = PMA_DBI_fetch_row($dispresult);
@PMA_DBI_free_result($dispresult);
} else {
$dispval = $GLOBALS['strLinkNotFound'];
}
} else {
$dispval = '';
}
$title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : '';
$vertical_display['data'][$row_no][$i] .= ''
. $row[$i] . ' ';
} else {
$vertical_display['data'][$row_no][$i] .= $row[$i];
}
$vertical_display['data'][$row_no][$i] .= ' ' . "\n";
} else {
$vertical_display['data'][$row_no][$i] = ' ' . "\n";
}
}
// lem9: output stored cell
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
echo $vertical_display['data'][$row_no][$i];
}
if (isset($vertical_display['rowdata'][$i][$row_no])) {
$vertical_display['rowdata'][$i][$row_no] .= $vertical_display['data'][$row_no][$i];
} else {
$vertical_display['rowdata'][$i][$row_no] = $vertical_display['data'][$row_no][$i];
}
} // end for (2)
// 3. Displays the modify/delete links on the right if required
if ($GLOBALS['cfg']['ModifyDeleteAtRight']
&& ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped')) {
$doWriteModifyAt = 'right';
require './libraries/display_tbl_links.lib.php';
} // end if (3)
if ($_SESSION['userconf']['disp_direction'] == 'horizontal'
|| $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
?>
' . "\n"
. ' ' . "\n"
. ' ' . "\n";
} else {
unset($vertical_display['row_delete'][$row_no]);
}
if (isset($edit_url)) {
$vertical_display['edit'][$row_no] .= ' ' . "\n"
. PMA_linkOrButton($edit_url, $edit_str, array(), false)
. $bookmark_go
. ' ' . "\n";
} else {
unset($vertical_display['edit'][$row_no]);
}
if (isset($del_url)) {
$vertical_display['delete'][$row_no] .= ' ' . "\n"
. PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''), false)
. ' ' . "\n";
} else {
unset($vertical_display['delete'][$row_no]);
}
echo (($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') ? "\n" : '');
$row_no++;
} // end while
if (isset($url_query)) {
$GLOBALS['url_query'] = $url_query;
}
return true;
} // end of the 'PMA_displayTableBody()' function
/**
* Do display the result table with the vertical direction mode.
* Credits for this feature goes to Garvin Hicking .
*
* @return boolean always true
*
* @uses $_SESSION['userconf']['repeat_cells']
* @global array $vertical_display the information to display
*
* @access private
*
* @see PMA_displayTable()
*/
function PMA_displayVerticalTable()
{
global $vertical_display;
// Displays "multi row delete" link at top if required
if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) {
echo '' . "\n";
echo $vertical_display['textbtn'];
$foo_counter = 0;
foreach ($vertical_display['row_delete'] as $val) {
if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) {
echo ' ' . "\n";
}
echo str_replace('[%_PMA_CHECKBOX_DIR_%]', '', $val);
$foo_counter++;
} // end while
echo ' ' . "\n";
} // end if
// Displays "edit" link at top if required
if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['edit']) && (count($vertical_display['edit']) > 0 || !empty($vertical_display['textbtn']))) {
echo '' . "\n";
if (!is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn'];
}
$foo_counter = 0;
foreach ($vertical_display['edit'] as $val) {
if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) {
echo ' ' . "\n";
}
echo $val;
$foo_counter++;
} // end while
echo ' ' . "\n";
} // end if
// Displays "delete" link at top if required
if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['delete']) && (count($vertical_display['delete']) > 0 || !empty($vertical_display['textbtn']))) {
echo '' . "\n";
if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn'];
}
$foo_counter = 0;
foreach ($vertical_display['delete'] as $val) {
if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) {
echo ' ' . "\n";
}
echo $val;
$foo_counter++;
} // end while
echo ' ' . "\n";
} // end if
// Displays data
foreach ($vertical_display['desc'] AS $key => $val) {
echo '' . "\n";
echo $val;
$foo_counter = 0;
foreach ($vertical_display['rowdata'][$key] as $subval) {
if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) and !($foo_counter % $_SESSION['userconf']['repeat_cells'])) {
echo $val;
}
echo $subval;
$foo_counter++;
} // end while
echo ' ' . "\n";
} // end while
// Displays "multi row delete" link at bottom if required
if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) {
echo '' . "\n";
echo $vertical_display['textbtn'];
$foo_counter = 0;
foreach ($vertical_display['row_delete'] as $val) {
if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) {
echo ' ' . "\n";
}
echo str_replace('[%_PMA_CHECKBOX_DIR_%]', 'r', $val);
$foo_counter++;
} // end while
echo ' ' . "\n";
} // end if
// Displays "edit" link at bottom if required
if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['edit']) && (count($vertical_display['edit']) > 0 || !empty($vertical_display['textbtn']))) {
echo '' . "\n";
if (!is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn'];
}
$foo_counter = 0;
foreach ($vertical_display['edit'] as $val) {
if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) {
echo ' ' . "\n";
}
echo $val;
$foo_counter++;
} // end while
echo ' ' . "\n";
} // end if
// Displays "delete" link at bottom if required
if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['delete']) && (count($vertical_display['delete']) > 0 || !empty($vertical_display['textbtn']))) {
echo '' . "\n";
if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn'];
}
$foo_counter = 0;
foreach ($vertical_display['delete'] as $val) {
if (($foo_counter != 0) && ($_SESSION['userconf']['repeat_cells'] != 0) && !($foo_counter % $_SESSION['userconf']['repeat_cells'])) {
echo ' ' . "\n";
}
echo $val;
$foo_counter++;
} // end while
echo ' ' . "\n";
}
return true;
} // end of the 'PMA_displayVerticalTable' function
/**
*
* @uses $_SESSION['userconf']['disp_direction']
* @uses $_REQUEST['disp_direction']
* @uses $GLOBALS['cfg']['DefaultDisplay']
* @uses $_SESSION['userconf']['repeat_cells']
* @uses $_REQUEST['repeat_cells']
* @uses $GLOBALS['cfg']['RepeatCells']
* @uses $_SESSION['userconf']['max_rows']
* @uses $_REQUEST['session_max_rows']
* @uses $GLOBALS['cfg']['MaxRows']
* @uses $_SESSION['userconf']['pos']
* @uses $_REQUEST['pos']
* @uses $_SESSION['userconf']['dontlimitchars']
* @uses $_REQUEST['dontlimitchars']
* @uses PMA_isValid()
* @uses $GLOBALS['sql_query']
* @todo make maximum remembered queries configurable
* @todo move/split into SQL class!?
* @todo currently this is called twice unnecessary
* @todo ignore LIMIT and ORDER in query!?
*/
function PMA_displayTable_checkConfigParams()
{
$sql_key = md5($GLOBALS['sql_query']);
$_SESSION['userconf']['query'][$sql_key]['sql'] = $GLOBALS['sql_query'];
if (PMA_isValid($_REQUEST['disp_direction'], array('horizontal', 'vertical', 'horizontalflipped'))) {
$_SESSION['userconf']['query'][$sql_key]['disp_direction'] = $_REQUEST['disp_direction'];
unset($_REQUEST['disp_direction']);
} elseif (empty($_SESSION['userconf']['query'][$sql_key]['disp_direction'])) {
$_SESSION['userconf']['query'][$sql_key]['disp_direction'] = $GLOBALS['cfg']['DefaultDisplay'];
}
if (PMA_isValid($_REQUEST['repeat_cells'], 'numeric')) {
$_SESSION['userconf']['query'][$sql_key]['repeat_cells'] = $_REQUEST['repeat_cells'];
unset($_REQUEST['repeat_cells']);
} elseif (empty($_SESSION['userconf']['query'][$sql_key]['repeat_cells'])) {
$_SESSION['userconf']['query'][$sql_key]['repeat_cells'] = $GLOBALS['cfg']['RepeatCells'];
}
if (PMA_isValid($_REQUEST['session_max_rows'], 'numeric') || $_REQUEST['session_max_rows'] == 'all') {
$_SESSION['userconf']['query'][$sql_key]['max_rows'] = $_REQUEST['session_max_rows'];
unset($_REQUEST['session_max_rows']);
} elseif (empty($_SESSION['userconf']['query'][$sql_key]['max_rows'])) {
$_SESSION['userconf']['query'][$sql_key]['max_rows'] = $GLOBALS['cfg']['MaxRows'];
}
if (PMA_isValid($_REQUEST['pos'], 'numeric')) {
$_SESSION['userconf']['query'][$sql_key]['pos'] = $_REQUEST['pos'];
unset($_REQUEST['pos']);
} elseif (empty($_SESSION['userconf']['query'][$sql_key]['pos'])) {
$_SESSION['userconf']['query'][$sql_key]['pos'] = 0;
}
if (PMA_isValid($_REQUEST['dontlimitchars'], array('0', '1'))) {
$_SESSION['userconf']['query'][$sql_key]['dontlimitchars'] = (int) $_REQUEST['dontlimitchars'];
unset($_REQUEST['dontlimitchars']);
} elseif (empty($_SESSION['userconf']['query'][$sql_key]['dontlimitchars'])) {
$_SESSION['userconf']['query'][$sql_key]['dontlimitchars'] = 0;
}
// move current query to the last position, to be removed last
// so only least executed query will be removed if maximum remembered queries
// limit is reached
$tmp = $_SESSION['userconf']['query'][$sql_key];
unset($_SESSION['userconf']['query'][$sql_key]);
$_SESSION['userconf']['query'][$sql_key] = $tmp;
// do not exceed a maximum number of queries to remember
if (count($_SESSION['userconf']['query']) > 10) {
array_shift($_SESSION['userconf']['query']);
//echo 'deleting one element ...';
}
// populate query configuration
$_SESSION['userconf']['dontlimitchars'] = $_SESSION['userconf']['query'][$sql_key]['dontlimitchars'];
$_SESSION['userconf']['pos'] = $_SESSION['userconf']['query'][$sql_key]['pos'];
$_SESSION['userconf']['max_rows'] = $_SESSION['userconf']['query'][$sql_key]['max_rows'];
$_SESSION['userconf']['repeat_cells'] = $_SESSION['userconf']['query'][$sql_key]['repeat_cells'];
$_SESSION['userconf']['disp_direction'] = $_SESSION['userconf']['query'][$sql_key]['disp_direction'];
/*
* debugging
echo '';
var_dump($_SESSION['userconf']);
echo ' ';
*/
}
/**
* Displays a table of results returned by a SQL query.
* This function is called by the "sql.php" script.
*
* @param integer the link id associated to the query which results have
* to be displayed
* @param array the display mode
* @param array the analyzed query
*
* @uses $_SESSION['userconf']['pos']
* @global string $db the database name
* @global string $table the table name
* @global string $goto the URL to go back in case of errors
* @global string $sql_query the current SQL query
* @global integer $num_rows the total number of rows returned by the
* SQL query
* @global integer $unlim_num_rows the total number of rows returned by the
* SQL query without any programmatically
* appended "LIMIT" clause
* @global array $fields_meta the list of fields properties
* @global integer $fields_cnt the total number of fields returned by
* the SQL query
* @global array $vertical_display informations used with vertical display
* mode
* @global array $highlight_columns column names to highlight
* @global array $cfgRelation the relation settings
*
* @access private
*
* @see PMA_showMessage(), PMA_setDisplayMode(),
* PMA_displayTableNavigation(), PMA_displayTableHeaders(),
* PMA_displayTableBody(), PMA_displayResultsOperations()
*/
function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
{
global $db, $table, $goto;
global $sql_query, $num_rows, $unlim_num_rows, $fields_meta, $fields_cnt;
global $vertical_display, $highlight_columns;
global $cfgRelation;
global $showtable;
PMA_displayTable_checkConfigParams();
/**
* @todo move this to a central place
* @todo for other future table types
*/
$is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
if ($is_innodb
&& ! isset($analyzed_sql[0]['queryflags']['union'])
&& ! isset($analyzed_sql[0]['table_ref'][1]['table_name'])
&& (empty($analyzed_sql[0]['where_clause'])
|| $analyzed_sql[0]['where_clause'] == '1 ')) {
// "j u s t b r o w s i n g"
$pre_count = '~';
$after_count = '[sup]1[/sup]';
} else {
$pre_count = '';
$after_count = '';
}
// 1. ----- Prepares the work -----
// 1.1 Gets the informations about which functionalities should be
// displayed
$total = '';
$is_display = PMA_setDisplayMode($the_disp_mode, $total);
// 1.2 Defines offsets for the next and previous pages
if ($is_display['nav_bar'] == '1') {
if ($_SESSION['userconf']['max_rows'] == 'all') {
$pos_next = 0;
$pos_prev = 0;
} else {
$pos_next = $_SESSION['userconf']['pos'] + $_SESSION['userconf']['max_rows'];
$pos_prev = $_SESSION['userconf']['pos'] - $_SESSION['userconf']['max_rows'];
if ($pos_prev < 0) {
$pos_prev = 0;
}
}
} // end if
// 1.3 URL-encodes the query to use in input form fields
$encoded_sql_query = urlencode($sql_query);
// 2. ----- Displays the top of the page -----
// 2.1 Displays a messages with position informations
if ($is_display['nav_bar'] == '1' && isset($pos_next)) {
if (isset($unlim_num_rows) && $unlim_num_rows != $total) {
$selectstring = ', ' . $unlim_num_rows . ' ' . $GLOBALS['strSelectNumRows'];
} else {
$selectstring = '';
}
$last_shown_rec = ($_SESSION['userconf']['max_rows'] == 'all' || $pos_next > $total)
? $total - 1
: $pos_next - 1;
PMA_showMessage($GLOBALS['strShowingRecords'] . ' ' . $_SESSION['userconf']['pos'] . ' - ' . $last_shown_rec . ' (' . $pre_count . PMA_formatNumber($total, 0) . $after_count . ' ' . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')');
if (PMA_Table::isView($db, $table) && $total == $GLOBALS['cfg']['MaxExactCount']) {
echo '' . "\n";
echo PMA_sanitize(sprintf($GLOBALS['strViewMaxExactCount'], PMA_formatNumber($GLOBALS['cfg']['MaxExactCount'], 0), '[a@./Documentation.html#cfg_MaxExactCount@_blank]', '[/a]')) . "\n";
echo '
' . "\n";
}
if ($pre_count) {
echo '' . "\n";
echo '1 ' . PMA_sanitize($GLOBALS['strApproximateCount']) . "\n";
echo '
' . "\n";
}
} elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
PMA_showMessage($GLOBALS['strSQLQuery']);
}
// 2.3 Displays the navigation bars
if (! strlen($table)) {
if (isset($analyzed_sql[0]['query_type'])
&& $analyzed_sql[0]['query_type'] == 'SELECT') {
// table does not always contain a real table name,
// for example in MySQL 5.0.x, the query SHOW STATUS
// returns STATUS as a table name
$table = $fields_meta[0]->table;
} else {
$table = '';
}
}
if ($is_display['nav_bar'] == '1') {
PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query);
echo "\n";
} elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
echo "\n" . ' ' . "\n";
}
// 2b ----- Get field references from Database -----
// (see the 'relation' configuration variable)
// loic1, 2002-03-02: extended to php3
// initialize map
$map = array();
// find tables
$target=array();
if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
foreach ($analyzed_sql[0]['table_ref'] AS $table_ref_position => $table_ref) {
$target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
}
}
$tabs = '(\'' . join('\',\'', $target) . '\')';
if ($cfgRelation['displaywork']) {
if (! strlen($table)) {
$exist_rel = false;
} else {
$exist_rel = PMA_getForeigners($db, $table, '', 'both');
if ($exist_rel) {
foreach ($exist_rel AS $master_field => $rel) {
$display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
$map[$master_field] = array($rel['foreign_table'],
$rel['foreign_field'],
$display_field,
$rel['foreign_db']);
} // end while
} // end if
} // end if
} // end if
// end 2b
// 3. ----- Displays the results table -----
PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql);
$url_query='';
echo '' . "\n";
PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql);
// vertical output case
if ($_SESSION['userconf']['disp_direction'] == 'vertical') {
PMA_displayVerticalTable();
} // end if
unset($vertical_display);
echo ' ' . "\n";
?>
';
}
echo $checkall_link . "\n"
.' / ' . "\n"
.$uncheckall_link . "\n"
.'