Example #1
0
 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column comments
  *                            as comments in the structure; this is deprecated
  *                            but the parameter is left here because export.php
  *                            calls PMA_exportStructure() also for other export
  *                            types which use this parameter
  * @param bool   $do_mime     whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  *
  * @return bool Whether it succeeded
  *
  * @access public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
 {
     global $cfgRelation;
     /* We do not export triggers */
     if ($export_mode == 'triggers') {
         return true;
     }
     /**
      * Get the unique keys in the table
      */
     $unique_keys = array();
     $keys = PMA_DBI_get_table_indexes($db, $table);
     foreach ($keys as $key) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     // Check if we can use Relations
     if ($do_relation && !empty($cfgRelation['relation'])) {
         // Find which tables are related with the current one and write it in
         // an array
         $res_rel = PMA_getForeigners($db, $table);
         if ($res_rel && count($res_rel) > 0) {
             $have_rel = true;
         } else {
             $have_rel = false;
         }
     } else {
         $have_rel = false;
     }
     // end if
     /**
      * Displays the table structure
      */
     $buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $table . $crlf . '%' . $crlf . ' \\begin{longtable}{';
     if (!PMA_exportOutputHandler($buffer)) {
         return false;
     }
     $columns_cnt = 4;
     $alignment = '|l|c|c|c|';
     if ($do_relation && $have_rel) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     if ($do_comments) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     $buffer = $alignment . '} ' . $crlf;
     $header = ' \\hline ';
     $header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Type') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Null') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Default') . '}}';
     if ($do_relation && $have_rel) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Links to') . '}}';
     }
     if ($do_comments) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Comments') . '}}';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     // Table caption for first page and label
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\label{' . PMA_expandUserString($GLOBALS['latex_structure_label'], null, array('table' => $table, 'database' => $db)) . '} \\\\' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
     // Table caption on next pages
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_structure_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\\\ ' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
     if (!PMA_exportOutputHandler($buffer)) {
         return false;
     }
     $fields = PMA_DBI_get_columns($db, $table);
     foreach ($fields as $row) {
         $extracted_fieldspec = PMA_extractFieldSpec($row['Type']);
         $type = $extracted_fieldspec['print_type'];
         if (empty($type)) {
             $type = ' ';
         }
         if (!isset($row['Default'])) {
             if ($row['Null'] != 'NO') {
                 $row['Default'] = 'NULL';
             }
         }
         $field_name = $row['Field'];
         $local_buffer = $field_name . "" . $type . "" . ($row['Null'] == '' || $row['Null'] == 'NO' ? __('No') : __('Yes')) . "" . (isset($row['Default']) ? $row['Default'] : '');
         if ($do_relation && $have_rel) {
             $local_buffer .= "";
             if (isset($res_rel[$field_name])) {
                 $local_buffer .= $res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')';
             }
         }
         if ($do_comments && $cfgRelation['commwork']) {
             $local_buffer .= "";
             if (isset($comments[$field_name])) {
                 $local_buffer .= $comments[$field_name];
             }
         }
         if ($do_mime && $cfgRelation['mimework']) {
             $local_buffer .= "";
             if (isset($mime_map[$field_name])) {
                 $local_buffer .= str_replace('_', '/', $mime_map[$field_name]['mimetype']);
             }
         }
         $local_buffer = PMA_texEscape($local_buffer);
         if ($row['Key'] == 'PRI') {
             $pos = strpos($local_buffer, "");
             $local_buffer = '\\textit{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
         }
         if (in_array($field_name, $unique_keys)) {
             $pos = strpos($local_buffer, "");
             $local_buffer = '\\textbf{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
         }
         $buffer = str_replace("", ' & ', $local_buffer);
         $buffer .= ' \\\\ \\hline ' . $crlf;
         if (!PMA_exportOutputHandler($buffer)) {
             return false;
         }
     }
     // end while
     $buffer = ' \\end{longtable}' . $crlf;
     return PMA_exportOutputHandler($buffer);
 }
Example #2
0
if ($asfile) {
    $pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
    if ($export_type == 'server') {
        if (isset($remember_template)) {
            $GLOBALS['PMA_Config']->setUserValue('pma_server_filename_template', 'Export/file_template_server', $filename_template);
        }
    } elseif ($export_type == 'database') {
        if (isset($remember_template)) {
            $GLOBALS['PMA_Config']->setUserValue('pma_db_filename_template', 'Export/file_template_database', $filename_template);
        }
    } else {
        if (isset($remember_template)) {
            $GLOBALS['PMA_Config']->setUserValue('pma_table_filename_template', 'Export/file_template_table', $filename_template);
        }
    }
    $filename = PMA_expandUserString($filename_template);
    // convert filename to iso-8859-1, it is safer
    $filename = PMA_convert_string($charset, 'iso-8859-1', $filename);
    // Grab basic dump extension and mime type
    // Check if the user already added extension; get the substring where the extension would be if it was included
    $extension_start_pos = strlen($filename) - strlen($export_list[$type]['extension']) - 1;
    $user_extension = substr($filename, $extension_start_pos, strlen($filename));
    $required_extension = "." . $export_list[$type]['extension'];
    if (strtolower($user_extension) != $required_extension) {
        $filename .= $required_extension;
    }
    $mime_type = $export_list[$type]['mime_type'];
    // If dump is going to be compressed, set correct mime_type and add
    // compression to extension
    if ($compression == 'bzip') {
        $filename .= '.bz2';
/**
 * prints querybox fieldset
 *
 * @param string  $query          query to display in the textarea
 * @param boolean $is_querywindow if inside querywindow or not
 * @param string  $delimiter      default delimiter to use
 *
 * @usedby  PMA_sqlQueryForm()
 */
function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter = ';')
{
    // enable auto select text in textarea
    if ($GLOBALS['cfg']['TextareaAutoSelect']) {
        $auto_sel = ' onclick="selectContent(this, sql_box_locked, true)"';
    } else {
        $auto_sel = '';
    }
    // enable locking if inside query window
    if ($is_querywindow) {
        $locking = ' onkeypress="document.sqlform.elements[\'LockFromUpdate\'].' . 'checked = true;"';
        $height = $GLOBALS['cfg']['TextareaRows'] * 1.25;
    } else {
        $locking = '';
        $height = $GLOBALS['cfg']['TextareaRows'] * 2;
    }
    $table = '';
    $db = '';
    $fields_list = array();
    if (!strlen($GLOBALS['db'])) {
        // prepare for server related
        $legend = sprintf(__('Run SQL query/queries on server %s'), '"' . htmlspecialchars(!empty($GLOBALS['cfg']['Servers'][$GLOBALS['server']]['verbose']) ? $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['verbose'] : $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host']) . '"');
    } elseif (!strlen($GLOBALS['table'])) {
        // prepare for db related
        $db = $GLOBALS['db'];
        // if you want navigation:
        $tmp_db_link = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db) . '"';
        if ($is_querywindow) {
            $tmp_db_link .= ' target="_self"' . ' onclick="this.target=window.opener.frame_content.name"';
        }
        $tmp_db_link .= '>' . htmlspecialchars($db) . '</a>';
        // else use
        // $tmp_db_link = htmlspecialchars($db);
        $legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link);
        if (empty($query)) {
            $query = PMA_expandUserString($GLOBALS['cfg']['DefaultQueryDatabase'], 'PMA_backquote');
        }
    } else {
        $table = $GLOBALS['table'];
        $db = $GLOBALS['db'];
        // Get the list and number of fields
        // we do a try_query here, because we could be in the query window,
        // trying to synchonize and the table has not yet been created
        $fields_list = PMA_DBI_get_columns($db, $GLOBALS['table'], null, true);
        $tmp_db_link = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db) . '"';
        if ($is_querywindow) {
            $tmp_db_link .= ' target="_self"' . ' onclick="this.target=window.opener.frame_content.name"';
        }
        $tmp_db_link .= '>' . htmlspecialchars($db) . '</a>';
        // else use
        // $tmp_db_link = htmlspecialchars($db);
        $legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link);
        if (empty($query)) {
            $query = PMA_expandUserString($GLOBALS['cfg']['DefaultQueryTable'], 'PMA_backquote');
        }
    }
    $legend .= ': ' . PMA_showMySQLDocu('SQL-Syntax', 'SELECT');
    if (count($fields_list)) {
        $sqlquerycontainer_id = 'sqlquerycontainer';
    } else {
        $sqlquerycontainer_id = 'sqlquerycontainerfull';
    }
    echo '<a id="querybox"></a>' . "\n" . '<div id="queryboxcontainer">' . "\n" . '<fieldset id="queryboxf">' . "\n";
    echo '<legend>' . $legend . '</legend>' . "\n";
    echo '<div id="queryfieldscontainer">' . "\n";
    echo '<div id="' . $sqlquerycontainer_id . '">' . "\n" . '<textarea tabindex="100" name="sql_query" id="sqlquery"' . '  cols="' . $GLOBALS['cfg']['TextareaCols'] . '"' . '  rows="' . $height . '"' . '  dir="' . $GLOBALS['text_dir'] . '"' . $auto_sel . $locking . '>' . htmlspecialchars($query) . '</textarea>' . "\n";
    // Add buttons to generate query easily for select all,single select,insert,update and delete
    if (count($fields_list)) {
        echo '<input type="button" value="SELECT *" id="selectall" class="button sqlbutton" />';
        echo '<input type="button" value="SELECT" id="select" class="button sqlbutton" />';
        echo '<input type="button" value="INSERT" id="insert" class="button sqlbutton" />';
        echo '<input type="button" value="UPDATE" id="update" class="button sqlbutton" />';
        echo '<input type="button" value="DELETE" id="delete" class="button sqlbutton" />';
    }
    echo '<input type="button" value="' . __('Clear') . '" id="clear" class="button sqlbutton" />';
    echo '</div>' . "\n";
    if (count($fields_list)) {
        echo '<div id="tablefieldscontainer">' . "\n" . '<label>' . __('Columns') . '</label>' . "\n" . '<select id="tablefields" name="dummy" ' . 'size="' . ($GLOBALS['cfg']['TextareaRows'] - 2) . '" ' . 'multiple="multiple" ondblclick="insertValueQuery()">' . "\n";
        foreach ($fields_list as $field) {
            echo '<option value="' . PMA_backquote(htmlspecialchars($field['Field'])) . '"';
            if (isset($field['Field']) && strlen($field['Field']) && isset($field['Comment'])) {
                echo ' title="' . htmlspecialchars($field['Comment']) . '"';
            }
            echo '>' . htmlspecialchars($field['Field']) . '</option>' . "\n";
        }
        echo '</select>' . "\n" . '<div id="tablefieldinsertbuttoncontainer">' . "\n";
        if ($GLOBALS['cfg']['PropertiesIconic']) {
            echo '<input type="button" class="button" name="insert" value="&lt;&lt;"' . ' onclick="insertValueQuery()"' . ' title="' . __('Insert') . '" />' . "\n";
        } else {
            echo '<input type="button" class="button" name="insert"' . ' value="' . __('Insert') . '"' . ' onclick="insertValueQuery()" />' . "\n";
        }
        echo '</div>' . "\n" . '</div>' . "\n";
    }
    echo '<div class="clearfloat"></div>' . "\n";
    echo '</div>' . "\n";
    if (!empty($GLOBALS['cfg']['Bookmark'])) {
        ?>
        <div id="bookmarkoptions">
        <div class="formelement">
        <label for="bkm_label">
            <?php 
        echo __('Bookmark this SQL query');
        ?>
:</label>
        <input type="text" name="bkm_label" id="bkm_label" tabindex="110" value="" />
        </div>
        <div class="formelement">
        <input type="checkbox" name="bkm_all_users" tabindex="111" id="id_bkm_all_users" value="true" />
        <label for="id_bkm_all_users">
            <?php 
        echo __('Let every user access this bookmark');
        ?>
</label>
        </div>
        <div class="formelement">
        <input type="checkbox" name="bkm_replace" tabindex="112" id="id_bkm_replace"
            value="true" />
        <label for="id_bkm_replace">
            <?php 
        echo __('Replace existing bookmark of same name');
        ?>
</label>
        </div>
        </div>
        <?php 
    }
    echo '<div class="clearfloat"></div>' . "\n";
    echo '</fieldset>' . "\n" . '</div>' . "\n";
    echo '<fieldset id="queryboxfooter" class="tblFooters">' . "\n";
    echo '<div class="formelement">' . "\n";
    if ($is_querywindow) {
        ?>
        <script type="text/javascript">
        //<![CDATA[
            document.writeln(' <input type="checkbox" name="LockFromUpdate" checked="checked" tabindex="120" id="checkbox_lock" /> <label for="checkbox_lock"><?php 
        echo __('Do not overwrite this query from outside the window');
        ?>
</label> ');
        //]]>
        </script>
        <?php 
    }
    echo '</div>' . "\n";
    echo '<div class="formelement">' . "\n";
    echo '<label for="id_sql_delimiter">[ ' . __('Delimiter') . '</label>' . "\n";
    echo '<input type="text" name="sql_delimiter" tabindex="131" size="3" ' . 'value="' . $delimiter . '" ' . 'id="id_sql_delimiter" /> ]' . "\n";
    echo '<input type="checkbox" name="show_query" value="1" ' . 'id="checkbox_show_query" tabindex="132" checked="checked" />' . "\n" . '<label for="checkbox_show_query">' . __('Show this query here again') . '</label>' . "\n";
    if (!$is_querywindow) {
        echo '<input type="checkbox" name="retain_query_box" value="1" ' . 'id="retain_query_box" tabindex="133" ' . ($GLOBALS['cfg']['RetainQueryBox'] === false ? '' : ' checked="checked"') . ' />' . '<label for="retain_query_box">' . __('Retain query box') . '</label>';
    }
    echo '</div>' . "\n";
    echo '<input type="submit" id="button_submit_query" name="SQL" tabindex="200" value="' . __('Go') . '" />' . "\n";
    echo '<div class="clearfloat"></div>' . "\n";
    echo '</fieldset>' . "\n";
}
 */
if (!defined('PHPMYADMIN')) {
    exit;
}
/**
 *
 */
require_once './libraries/common.inc.php';
// Cross-framing protection
if (false === $GLOBALS['cfg']['AllowThirdPartyFraming']) {
    echo PMA_includeJS('cross_framing_protection.js');
}
// generate title (unless we already have $page_title, from cookie auth)
if (!isset($page_title)) {
    if ($GLOBALS['server'] > 0) {
        $title = PMA_expandUserString(!empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] : (!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] : (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] : $GLOBALS['cfg']['TitleDefault'])));
    }
} else {
    $title = $page_title;
}
// here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
$is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
$GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'jquery/jquery.qtip-1.0.0.min.js';
$params = array('lang' => $GLOBALS['lang']);
if (isset($GLOBALS['db'])) {
    $params['db'] = $GLOBALS['db'];
}
$GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
/**
 * Here we add a timestamp when loading the file, so that users who
Example #5
0
 /**
  * Test case for expanding strings with escaping
  *
  * @dataProvider provider
  */
 public function testExpandEscape($in, $out)
 {
     $this->assertEquals(htmlspecialchars($out), PMA_expandUserString($in, 'htmlspecialchars'));
 }
Example #6
0
 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy)
 {
     global $cfgRelation;
     /**
      * Get the unique keys in the table
      */
     $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
     $keys_result = PMA_DBI_query($keys_query);
     $unique_keys = array();
     while ($key = PMA_DBI_fetch_assoc($keys_result)) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     PMA_DBI_free_result($keys_result);
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
     $result = PMA_DBI_query($local_query);
     $fields_cnt = PMA_DBI_num_rows($result);
     // Check if we can use Relations (Mike Beck)
     if ($do_relation && !empty($cfgRelation['relation'])) {
         // Find which tables are related with the current one and write it in
         // an array
         $res_rel = PMA_getForeigners($db, $table);
         if ($res_rel && count($res_rel) > 0) {
             $have_rel = TRUE;
         } else {
             $have_rel = FALSE;
         }
     } else {
         $have_rel = FALSE;
     }
     // end if
     /**
      * Displays the table structure
      */
     $buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $table . $crlf . '%' . $crlf . ' \\begin{longtable}{';
     if (!PMA_exportOutputHandler($buffer)) {
         return FALSE;
     }
     $columns_cnt = 4;
     $alignment = '|l|c|c|c|';
     if ($do_relation && $have_rel) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     if ($do_comments) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     $buffer = $alignment . '} ' . $crlf;
     $header = ' \\hline ';
     $header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Type') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Null') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Default') . '}}';
     if ($do_relation && $have_rel) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Links to') . '}}';
     }
     if ($do_comments) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Comments') . '}}';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $local_buffer = PMA_texEscape($table);
     // Table caption for first page and label
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\label{' . PMA_expandUserString($GLOBALS['latex_structure_label'], NULL, array('table' => $table, 'database' => $db)) . '} \\\\' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
     // Table caption on next pages
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_structure_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\\\ ' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
     if (!PMA_exportOutputHandler($buffer)) {
         return FALSE;
     }
     while ($row = PMA_DBI_fetch_assoc($result)) {
         $type = $row['Type'];
         // reformat mysql query output
         // set or enum types: slashes single quotes inside options
         if (preg_match('/^(set|enum)\\((.+)\\)$/i', $type, $tmp)) {
             $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
             $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
             $type_nowrap = '';
             $binary = 0;
             $unsigned = 0;
             $zerofill = 0;
         } else {
             $type_nowrap = ' nowrap="nowrap"';
             $type = preg_replace('/BINARY/i', '', $type);
             $type = preg_replace('/ZEROFILL/i', '', $type);
             $type = preg_replace('/UNSIGNED/i', '', $type);
             if (empty($type)) {
                 $type = '&nbsp;';
             }
             $binary = preg_match('/BINARY/i', $row['Type']);
             $unsigned = preg_match('/UNSIGNED/i', $row['Type']);
             $zerofill = preg_match('/ZEROFILL/i', $row['Type']);
         }
         if (!isset($row['Default'])) {
             if ($row['Null'] != 'NO') {
                 $row['Default'] = 'NULL';
             }
         } else {
             $row['Default'] = $row['Default'];
         }
         $field_name = $row['Field'];
         $local_buffer = $field_name . "" . $type . "" . ($row['Null'] == '' || $row['Null'] == 'NO' ? __('No') : __('Yes')) . "" . (isset($row['Default']) ? $row['Default'] : '');
         if ($do_relation && $have_rel) {
             $local_buffer .= "";
             if (isset($res_rel[$field_name])) {
                 $local_buffer .= $res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')';
             }
         }
         if ($do_comments && $cfgRelation['commwork']) {
             $local_buffer .= "";
             if (isset($comments[$field_name])) {
                 $local_buffer .= $comments[$field_name];
             }
         }
         if ($do_mime && $cfgRelation['mimework']) {
             $local_buffer .= "";
             if (isset($mime_map[$field_name])) {
                 $local_buffer .= str_replace('_', '/', $mime_map[$field_name]['mimetype']);
             }
         }
         $local_buffer = PMA_texEscape($local_buffer);
         if ($row['Key'] == 'PRI') {
             $pos = strpos($local_buffer, "");
             $local_buffer = '\\textit{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
         }
         if (in_array($field_name, $unique_keys)) {
             $pos = strpos($local_buffer, "");
             $local_buffer = '\\textbf{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
         }
         $buffer = str_replace("", ' & ', $local_buffer);
         $buffer .= ' \\\\ \\hline ' . $crlf;
         if (!PMA_exportOutputHandler($buffer)) {
             return FALSE;
         }
     }
     // end while
     PMA_DBI_free_result($result);
     $buffer = ' \\end{longtable}' . $crlf;
     return PMA_exportOutputHandler($buffer);
 }
}
// generate title (unless we already have $page_title, from cookie auth)
if (!isset($page_title)) {
    if ($GLOBALS['server'] > 0) {
        if (!empty($GLOBALS['table'])) {
            $temp_title = $GLOBALS['cfg']['TitleTable'];
        } else {
            if (!empty($GLOBALS['db'])) {
                $temp_title = $GLOBALS['cfg']['TitleDatabase'];
            } elseif (!empty($GLOBALS['cfg']['Server']['host'])) {
                $temp_title = $GLOBALS['cfg']['TitleServer'];
            } else {
                $temp_title = $GLOBALS['cfg']['TitleDefault'];
            }
        }
        $title = PMA_expandUserString($temp_title);
    }
} else {
    $title = $page_title;
}
// here, the function does not exist with this configuration:
// $cfg['ServerDefault'] = 0;
$is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
$GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'jquery/jquery.qtip-1.0.0-rc3.js';
if ($GLOBALS['cfg']['CodemirrorEnable']) {
    $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
    $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
}
$params = array('lang' => $GLOBALS['lang']);
if (isset($GLOBALS['db'])) {