diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 4e330fa5d..16e115940 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -2830,7 +2830,7 @@ $mapping = array( /** * Formats user string, expading @VARIABLES@, accepting strftime format string. */ -function PMA_expandUserString($string) { +function PMA_expandUserString($string, $escape = NULL) { /* Content */ $http_host = PMA_getenv('HTTP_HOST') ? PMA_getenv('HTTP_HOST') : ''; $server_name = $GLOBALS['cfg']['Server']['host']; @@ -2854,6 +2854,12 @@ function PMA_expandUserString($string) { '@PHPMYADMIN@' => $phpmyadmin_version, ); + if (!is_null($escape)) { + foreach($replace as $key => $val) { + $replace[$key] = $escape($val); + } + } + /* Do the replacement */ return str_replace(array_keys($replace), array_values($replace), strftime($string)); } diff --git a/libraries/export/latex.php b/libraries/export/latex.php index ccf87e96e..9e6bd88a0 100644 --- a/libraries/export/latex.php +++ b/libraries/export/latex.php @@ -207,8 +207,8 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { $buffer .= ' \\hline \\endhead \\hline \\endfoot \\hline ' . $crlf; if (isset($GLOBALS['latex_caption'])) { - $buffer .= ' \\caption{' . str_replace('__TABLE__', PMA_texEscape($table), $GLOBALS['latex_data_caption']) - . '} \\label{' . str_replace('__TABLE__', $table, $GLOBALS['latex_data_label']) . '} \\\\'; + $buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_data_caption'], 'PMA_texEscape') + . '} \\label{' . PMA_expandUserString($GLOBALS['latex_data_label']) . '} \\\\'; } if (!PMA_exportOutputHandler($buffer)) { return FALSE; @@ -226,7 +226,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { return FALSE; } if (isset($GLOBALS['latex_caption'])) { - if (!PMA_exportOutputHandler('\\caption{' . str_replace('__TABLE__', PMA_texEscape($table), $GLOBALS['latex_data_continued_caption']) . '} \\\\ ')) return FALSE; + if (!PMA_exportOutputHandler('\\caption{' . PMA_expandUserString($GLOBALS['latex_data_continued_caption'], 'PMA_texEscape') . '} \\\\ ')) return FALSE; } if (!PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) { return FALSE; @@ -289,7 +289,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { * * @access public */ - // @@@ Table structure + // @@@ Table structure function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy) { global $cfgRelation; @@ -373,14 +373,14 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals // Table caption for first page and label if (isset($GLOBALS['latex_caption'])) { - $buffer .= ' \\caption{'. str_replace('__TABLE__', PMA_texEscape($table), $GLOBALS['latex_structure_caption']) - . '} \\label{' . str_replace('__TABLE__', $table, $GLOBALS['latex_structure_label']) + $buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape') + . '} \\label{' . PMA_expandUserString($GLOBALS['latex_structure_label']) . '} \\\\' . $crlf; } $buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf; // Table caption on next pages if (isset($GLOBALS['latex_caption'])) { - $buffer .= ' \\caption{'. str_replace('__TABLE__', PMA_texEscape($table), $GLOBALS['latex_structure_continued_caption']) + $buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_continued_caption'], 'PMA_texEscape') . '} \\\\ ' . $crlf; } $buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf; @@ -425,8 +425,8 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $field_name = $row['Field']; - $local_buffer = $field_name . "\000" . $type . "\000" - . (($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes')) + $local_buffer = $field_name . "\000" . $type . "\000" + . (($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes')) . "\000" . (isset($row['Default']) ? $row['Default'] : ''); if ($do_relation && $have_rel) {