00001 <?php
00002
00003
00004
00016 function PMA_exportComment($text) {
00017 return PMA_exportOutputHandler('<!-- ' . $text . ' -->' . $GLOBALS['crlf']);
00018 }
00019
00027 function PMA_exportFooter() {
00028 return TRUE;
00029 }
00030
00038 function PMA_exportHeader() {
00039 global $crlf;
00040 global $cfg;
00041
00042 if ($GLOBALS['output_charset_conversion']) {
00043 $charset = $GLOBALS['charset_of_file'];
00044 } else {
00045 $charset = $GLOBALS['charset'];
00046 }
00047
00048 $head = '<?xml version="1.0" encoding="' . $charset . '" ?>' . $crlf
00049 . '<!--' . $crlf
00050 . '-' . $crlf
00051 . '- phpMyAdmin XML Dump' . $crlf
00052 . '- version ' . PMA_VERSION . $crlf
00053 . '- http:
00054 . '-' . $crlf
00055 . '- ' . $GLOBALS['strHost'] . ': ' . $cfg['Server']['host'];
00056 if (!empty($cfg['Server']['port'])) {
00057 $head .= ':' . $cfg['Server']['port'];
00058 }
00059 $head .= $crlf
00060 . '- ' . $GLOBALS['strGenTime'] . ': ' . PMA_localisedDate() . $crlf
00061 . '- ' . $GLOBALS['strServerVersion'] . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 3) . $crlf
00062 . '- ' . $GLOBALS['strPHPVersion'] . ': ' . phpversion() . $crlf
00063 . '-->' . $crlf . $crlf;
00064 return PMA_exportOutputHandler($head);
00065 }
00066
00076 function PMA_exportDBHeader($db) {
00077 global $crlf;
00078 $head = '<!--' . $crlf
00079 . '- ' . $GLOBALS['strDatabase'] . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
00080 . '-->' . $crlf
00081 . '<' . $db . '>' . $crlf;
00082 return PMA_exportOutputHandler($head);
00083 }
00084
00094 function PMA_exportDBFooter($db) {
00095 global $crlf;
00096 return PMA_exportOutputHandler('</' . $db . '>' . $crlf);
00097 }
00098
00108 function PMA_exportDBCreate($db) {
00109 return TRUE;
00110 }
00111
00112
00126 function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
00127 $result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
00128
00129 $columns_cnt = PMA_DBI_num_fields($result);
00130 for ($i = 0; $i < $columns_cnt; $i++) {
00131 $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
00132 }
00133 unset($i);
00134
00135 $buffer = ' <!-- ' . $GLOBALS['strTable'] . ' ' . $table . ' -->' . $crlf;
00136 if (!PMA_exportOutputHandler($buffer)) return FALSE;
00137
00138 while ($record = PMA_DBI_fetch_row($result)) {
00139 $buffer = ' <' . $table . '>' . $crlf;
00140 for ($i = 0; $i < $columns_cnt; $i++) {
00141 if ( isset($record[$i]) && !is_null($record[$i])) {
00142 $buffer .= ' <' . $columns[$i] . '>' . htmlspecialchars($record[$i])
00143 . '</' . $columns[$i] . '>' . $crlf;
00144 }
00145 }
00146 $buffer .= ' </' . $table . '>' . $crlf;
00147
00148 if (!PMA_exportOutputHandler($buffer)) return FALSE;
00149 }
00150 PMA_DBI_free_result($result);
00151
00152 return TRUE;
00153 }
00154 ?>