Documentation TYPO3 par Ameos |
00001 <?php 00002 /* $Id: xml.php,v 2.1 2003/11/20 16:31:51 garvinhicking Exp $ */ 00003 // vim: expandtab sw=4 ts=4 sts=4: 00004 00016 function PMA_exportComment($text) { 00017 return PMA_exportOutputHandler('<!-- ' . $text . ' -->' . $GLOBALS['crlf']); 00018 } 00019 00027 function PMA_exportHeader() { 00028 global $crlf; 00029 global $cfg; 00030 00031 if ($GLOBALS['output_charset_conversion']) { 00032 $charset = $GLOBALS['charset_of_file']; 00033 } else { 00034 $charset = $GLOBALS['charset']; 00035 } 00036 00037 $head = '<?xml version="1.0" encoding="' . $charset . '" ?>' . $crlf 00038 . '<!--' . $crlf 00039 . '-' . $crlf 00040 . '- phpMyAdmin XML Dump' . $crlf 00041 . '- version ' . PMA_VERSION . $crlf 00042 . '- http://www.phpmyadmin.net' . $crlf 00043 . '-' . $crlf 00044 . '- ' . $GLOBALS['strHost'] . ': ' . $cfg['Server']['host']; 00045 if (!empty($cfg['Server']['port'])) { 00046 $head .= ':' . $cfg['Server']['port']; 00047 } 00048 $head .= $crlf 00049 . '- ' . $GLOBALS['strGenTime'] . ': ' . PMA_localisedDate() . $crlf 00050 . '- ' . $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 00051 . '- ' . $GLOBALS['strPHPVersion'] . ': ' . phpversion() . $crlf 00052 . '-->' . $crlf . $crlf; 00053 return PMA_exportOutputHandler($head); 00054 } 00055 00065 function PMA_exportDBHeader($db) { 00066 global $crlf; 00067 $head = '<!--' . $crlf 00068 . '- ' . $GLOBALS['strDatabase'] . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf 00069 . '-->' . $crlf 00070 . '<' . $db . '>' . $crlf; 00071 return PMA_exportOutputHandler($head); 00072 } 00073 00083 function PMA_exportDBFooter($db) { 00084 global $crlf; 00085 return PMA_exportOutputHandler('</' . $db . '>' . $crlf); 00086 } 00087 00097 function PMA_exportDBCreate($db) { 00098 return TRUE; 00099 } 00100 00101 00115 function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { 00116 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $error_url); 00117 00118 $columns_cnt = mysql_num_fields($result); 00119 for ($i = 0; $i < $columns_cnt; $i++) { 00120 $columns[$i] = stripslashes(mysql_field_name($result, $i)); 00121 } 00122 unset($i); 00123 00124 $buffer = ' <!-- ' . $GLOBALS['strTable'] . ' ' . $table . ' -->' . $crlf; 00125 if (!PMA_exportOutputHandler($buffer)) return FALSE; 00126 00127 while ($record = PMA_mysql_fetch_array($result, MYSQL_ASSOC)) { 00128 $buffer = ' <' . $table . '>' . $crlf; 00129 for ($i = 0; $i < $columns_cnt; $i++) { 00130 // There is no way to dectect a "NULL" value with PHP3 00131 if ( isset($record[$columns[$i]]) && (!function_exists('is_null') || !is_null($record[$columns[$i]]))) { 00132 $buffer .= ' <' . $columns[$i] . '>' . htmlspecialchars(stripslashes($record[$columns[$i]])) 00133 . '</' . $columns[$i] . '>' . $crlf; 00134 } 00135 } 00136 $buffer .= ' </' . $table . '>' . $crlf; 00137 00138 if (!PMA_exportOutputHandler($buffer)) return FALSE; 00139 } 00140 mysql_free_result($result); 00141 00142 return TRUE; 00143 } // end of the 'PMA_getTableXML()' function 00144 ?>