本文整理汇总了PHP中PMA_Util::expandUserString方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::expandUserString方法的具体用法?PHP PMA_Util::expandUserString怎么用?PHP PMA_Util::expandUserString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Util
的用法示例。
在下文中一共展示了PMA_Util::expandUserString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExpandEscape
/**
* Test case for expanding strings with escaping
*
* @param string $in string to evaluate
* @param string $out expected output
*
* @return void
*
* @dataProvider provider
*/
public function testExpandEscape($in, $out)
{
$out = str_replace('PMA_VERSION', PMA_VERSION, $out);
$this->assertEquals(
htmlspecialchars($out),
PMA_Util::expandUserString(
$in, 'htmlspecialchars'
)
);
}
示例2: _getPageTitle
/**
* If the page is missing the title, this function
* will set it to something reasonable
*
* @return string
*/
private function _getPageTitle()
{
if (empty($this->_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'];
}
}
$this->_title = htmlspecialchars(PMA_Util::expandUserString($temp_title));
} else {
$this->_title = 'phpMyAdmin';
}
}
return $this->_title;
}
示例3: PMA_getHtmlForSqlQueryFormInsert
/**
* return HTML for Sql Query Form Insert
*
* @param string $query query to display in the textarea
* @param string $delimiter default delimiter to use
*
* @return string
*
* @usedby PMA_getHtmlForSqlQueryForm()
*/
function PMA_getHtmlForSqlQueryFormInsert($query = '', $delimiter = ';')
{
// enable auto select text in textarea
if ($GLOBALS['cfg']['TextareaAutoSelect']) {
$auto_sel = ' onclick="selectContent(this, sql_box_locked, true);"';
} else {
$auto_sel = '';
}
$locking = '';
$height = $GLOBALS['cfg']['TextareaRows'] * 2;
$table = '';
$db = '';
$fields_list = array();
if (!mb_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 (!mb_strlen($GLOBALS['table'])) {
// prepare for db related
$db = $GLOBALS['db'];
// if you want navigation:
$tmp_db_link = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . PMA_URL_getCommon(array('db' => $db)) . '"';
$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_Util::expandUserString($GLOBALS['cfg']['DefaultQueryDatabase'], '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 synchronize and the table has not yet been created
$fields_list = $GLOBALS['dbi']->getColumns($db, $GLOBALS['table'], null, true);
$tmp_db_link = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . PMA_URL_getCommon(array('db' => $db)) . '"';
$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_Util::expandUserString($GLOBALS['cfg']['DefaultQueryTable'], 'backquote');
}
}
$legend .= ': ' . PMA_Util::showMySQLDocu('SELECT');
if (count($fields_list)) {
$sqlquerycontainer_id = 'sqlquerycontainer';
} else {
$sqlquerycontainer_id = 'sqlquerycontainerfull';
}
$html = '<a id="querybox"></a>' . '<div id="queryboxcontainer">' . '<fieldset id="queryboxf">';
$html .= '<legend>' . $legend . '</legend>';
$html .= '<div id="queryfieldscontainer">';
$html .= '<div id="' . $sqlquerycontainer_id . '">' . '<textarea tabindex="100" name="sql_query" id="sqlquery"' . ' cols="' . $GLOBALS['cfg']['TextareaCols'] . '"' . ' rows="' . $height . '"' . ' dir="' . $GLOBALS['text_dir'] . '"' . $auto_sel . $locking . '>' . htmlspecialchars($query) . '</textarea>';
// Add buttons to generate query easily for
// select all, single select, insert, update and delete
if (count($fields_list)) {
$html .= '<input type="button" value="SELECT *" id="selectall"' . ' class="button sqlbutton" />';
$html .= '<input type="button" value="SELECT" id="select"' . ' class="button sqlbutton" />';
$html .= '<input type="button" value="INSERT" id="insert"' . ' class="button sqlbutton" />';
$html .= '<input type="button" value="UPDATE" id="update"' . ' class="button sqlbutton" />';
$html .= '<input type="button" value="DELETE" id="delete"' . ' class="button sqlbutton" />';
}
$html .= '<input type="button" value="' . __('Clear') . '" id="clear"' . ' class="button sqlbutton" />';
$html .= '</div>' . "\n";
if (count($fields_list)) {
$html .= '<div id="tablefieldscontainer">' . '<label>' . __('Columns') . '</label>' . '<select id="tablefields" name="dummy" ' . 'size="' . ($GLOBALS['cfg']['TextareaRows'] - 2) . '" ' . 'multiple="multiple" ondblclick="insertValueQuery()">';
foreach ($fields_list as $field) {
$html .= '<option value="' . PMA_Util::backquote(htmlspecialchars($field['Field'])) . '"';
if (isset($field['Field']) && mb_strlen($field['Field']) && isset($field['Comment'])) {
$html .= ' title="' . htmlspecialchars($field['Comment']) . '"';
}
$html .= '>' . htmlspecialchars($field['Field']) . '</option>' . "\n";
}
$html .= '</select>' . '<div id="tablefieldinsertbuttoncontainer">';
if (PMA_Util::showIcons('ActionLinksMode')) {
$html .= '<input type="button" class="button" name="insert"' . ' value="<<" onclick="insertValueQuery()"' . ' title="' . __('Insert') . '" />';
} else {
$html .= '<input type="button" class="button" name="insert"' . ' value="' . __('Insert') . '"' . ' onclick="insertValueQuery()" />';
}
$html .= '</div>' . "\n" . '</div>' . "\n";
}
$html .= '<div class="clearfloat"></div>' . "\n";
$html .= '</div>' . "\n";
$cfgBookmark = PMA_Bookmark_getParams();
if ($cfgBookmark) {
$html .= '<div id="bookmarkoptions">';
$html .= '<div class="formelement">';
$html .= '<label for="bkm_label">' . __('Bookmark this SQL query:') . '</label>';
$html .= '<input type="text" name="bkm_label" id="bkm_label"' . ' tabindex="110" value="" />';
//.........这里部分代码省略.........
示例4: PMA_getExportFilenameAndMimetype
/**
* Return the filename and MIME type for export file
*
* @param string $export_type type of export
* @param string $remember_template whether to remember template
* @param ExportPlugin $export_plugin the export plugin
* @param string $compression compression asked
* @param string $filename_template the filename template
*
* @return array the filename template and mime type
*/
function PMA_getExportFilenameAndMimetype($export_type, $remember_template, $export_plugin, $compression, $filename_template)
{
if ($export_type == 'server') {
if (!empty($remember_template)) {
$GLOBALS['PMA_Config']->setUserValue('pma_server_filename_template', 'Export/file_template_server', $filename_template);
}
} elseif ($export_type == 'database') {
if (!empty($remember_template)) {
$GLOBALS['PMA_Config']->setUserValue('pma_db_filename_template', 'Export/file_template_database', $filename_template);
}
} else {
if (!empty($remember_template)) {
$GLOBALS['PMA_Config']->setUserValue('pma_table_filename_template', 'Export/file_template_table', $filename_template);
}
}
$filename = PMA_Util::expandUserString($filename_template);
// remove dots in filename (coming from either the template or already
// part of the filename) to avoid a remote code execution vulnerability
$filename = PMA_sanitizeFilename($filename, $replaceDots = true);
// 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 = mb_strlen($filename) - mb_strlen($export_plugin->getProperties()->getExtension()) - 1;
$user_extension = mb_substr($filename, $extension_start_pos, mb_strlen($filename));
$required_extension = "." . $export_plugin->getProperties()->getExtension();
if (mb_strtolower($user_extension) != $required_extension) {
$filename .= $required_extension;
}
$mime_type = $export_plugin->getProperties()->getMimeType();
// If dump is going to be compressed, set correct mime_type and add
// compression to extension
if ($compression == 'gzip') {
$filename .= '.gz';
$mime_type = 'application/x-gzip';
} elseif ($compression == 'zip') {
$filename .= '.zip';
$mime_type = 'application/zip';
}
return array($filename, $mime_type);
}
示例5: PMA_initQueryForm
/**
* Get initial values for Sql Query Form Insert
*
* @param string $query query to display in the textarea
*
* @return array ($legend, $query, $columns_list)
*
* @usedby PMA_getHtmlForSqlQueryFormInsert()
*/
function PMA_initQueryForm($query)
{
$columns_list = array();
if (!mb_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 (!mb_strlen($GLOBALS['table'])) {
// prepare for db related
$db = $GLOBALS['db'];
// if you want navigation:
$tmp_db_link = '<a href="' . PMA_Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database') . PMA_URL_getCommon(array('db' => $db)) . '"';
$tmp_db_link .= '>' . htmlspecialchars($db) . '</a>';
$legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link);
if (empty($query)) {
$query = PMA_Util::expandUserString($GLOBALS['cfg']['DefaultQueryDatabase'], 'backquote');
}
} else {
$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 synchronize and the table has not yet been created
$columns_list = $GLOBALS['dbi']->getColumns($db, $GLOBALS['table'], null, true);
$tmp_db_link = '<a href="' . PMA_Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database') . PMA_URL_getCommon(array('db' => $db)) . '"';
$tmp_db_link .= '>' . htmlspecialchars($db) . '</a>';
$legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link);
if (empty($query)) {
$query = PMA_Util::expandUserString($GLOBALS['cfg']['DefaultQueryTable'], 'backquote');
}
}
$legend .= ': ' . PMA_Util::showMySQLDocu('SELECT');
return array($legend, $query, $columns_list);
}
示例6: exportStructure
/**
* 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 string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @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
* 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 array $aliases Aliases of db/table/columns
*
* @return bool Whether it succeeded
*/
public function exportStructure($db, $table, $crlf, $error_url, $export_mode, $export_type, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $aliases = array())
{
$db_alias = $db;
$table_alias = $table;
$this->initAlias($aliases, $db_alias, $table_alias);
global $cfgRelation;
/* We do not export triggers */
if ($export_mode == 'triggers') {
return true;
}
/**
* Get the unique keys in the table
*/
$unique_keys = array();
$keys = $GLOBALS['dbi']->getTableIndexes($db, $table);
foreach ($keys as $key) {
if ($key['Non_unique'] == 0) {
$unique_keys[] = $key['Column_name'];
}
}
/**
* Gets fields properties
*/
$GLOBALS['dbi']->selectDb($db);
// Check if we can use Relations
list($res_rel, $have_rel) = PMA_getRelationsAndStatus($do_relation && !empty($cfgRelation['relation']), $db, $table);
/**
* Displays the table structure
*/
$buffer = $crlf . '%' . $crlf . '% ' . __('Structure:') . ' ' . $table_alias . $crlf . '%' . $crlf . ' \\begin{longtable}{';
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
$alignment = '|l|c|c|c|';
if ($do_relation && $have_rel) {
$alignment .= 'l|';
}
if ($do_comments) {
$alignment .= 'l|';
}
if ($do_mime && $cfgRelation['mimework']) {
$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_Util::expandUserString($GLOBALS['latex_structure_caption'], array('texEscape', get_class($this), 'libraries/plugins/export/' . get_class($this) . ".class.php"), array('table' => $table_alias, 'database' => $db_alias)) . '} \\label{' . PMA_Util::expandUserString($GLOBALS['latex_structure_label'], null, array('table' => $table_alias, 'database' => $db_alias)) . '} \\\\' . $crlf;
}
$buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
// Table caption on next pages
if (isset($GLOBALS['latex_caption'])) {
$buffer .= ' \\caption{' . PMA_Util::expandUserString($GLOBALS['latex_structure_continued_caption'], array('texEscape', get_class($this), 'libraries/plugins/export/' . get_class($this) . ".class.php"), array('table' => $table_alias, 'database' => $db_alias)) . '} \\\\ ' . $crlf;
}
$buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
$fields = $GLOBALS['dbi']->getColumns($db, $table);
foreach ($fields as $row) {
$extracted_columnspec = PMA_Util::extractColumnSpec($row['Type']);
$type = $extracted_columnspec['print_type'];
if (empty($type)) {
$type = ' ';
}
//.........这里部分代码省略.........
示例7: parse_url
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_Util::expandUserString($filename_template);
// remove dots in filename (coming from either the template or already
// part of the filename) to avoid a remote code execution vulnerability
$filename = PMA_sanitizeFilename($filename, $replaceDots = true);
// 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_plugin->getProperties()->getExtension()) - 1;
$user_extension = substr($filename, $extension_start_pos, strlen($filename));
$required_extension = "." . $export_plugin->getProperties()->getExtension();
if (strtolower($user_extension) != $required_extension) {
$filename .= $required_extension;
}
$mime_type = $export_plugin->getProperties()->getMimeType();
// If dump is going to be compressed, set correct mime_type and add
// compression to extension
示例8: PMA_sqlQueryFormInsert
/**
* 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
*
* @return void
*
* @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_Util::expandUserString($GLOBALS['cfg']['DefaultQueryDatabase'], '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_Util::expandUserString($GLOBALS['cfg']['DefaultQueryTable'], 'backquote');
}
}
$legend .= ': ' . PMA_Util::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_Util::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="<<"' . ' onclick="insertValueQuery()"' . ' title="' . __('Insert') . '" />' . "\n";
//.........这里部分代码省略.........
示例9: exportStructure
/**
* 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 string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @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
* 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
*
* @return bool Whether it succeeded
*/
public function exportStructure($db, $table, $crlf, $error_url, $export_mode, $export_type, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false)
{
global $cfgRelation;
/**
* 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_Util::expandUserString($GLOBALS['latex_structure_caption'], array('texEscape', get_class($this), 'libraries/plugins/export/' . get_class($this) . ".class.php"), array('table' => $table, 'database' => $db)) . '} \\label{' . PMA_Util::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_Util::expandUserString($GLOBALS['latex_structure_continued_caption'], array('texEscape', get_class($this), 'libraries/plugins/export/' . get_class($this) . ".class.php"), array('table' => $table, 'database' => $db)) . '} \\\\ ' . $crlf;
}
$buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
return false;
//.........这里部分代码省略.........