Advertisement
Guest User

Jakub Vrana

a guest
Oct 29th, 2010
1,139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. function dumpFormat() {
  2.     return parent::dumpFormat() + array('xml' => 'XML');
  3. }
  4.  
  5. function dumpData($table, $style, $query) {
  6.     if ($_POST["format"] == "xml") {
  7.         echo "<database name='" . h(DB) . "'>\n";
  8.         $connection = connection();
  9.         $result = $connection->query($query, 1);
  10.         if ($result) {
  11.             while ($row = $result->fetch_assoc()) {
  12.                 echo "\t<table name='" . h($table) . "'>\n";
  13.                 foreach ($row as $key => $val) {
  14.                     echo "\t\t<column name='" . h($key) . "'>" . h($val) . "</column>\n";
  15.                 }
  16.                 echo "\t</table>\n";
  17.             }
  18.         }
  19.         echo "</database>\n";
  20.     } else {
  21.         return parent::dumpData($table, $style, $query);
  22.     }
  23. }
  24.  
  25. function dumpHeaders($identifier, $multi_table = false) {
  26.     if ($_POST["format"] == "xml") {
  27.         header("Content-Type: text/xml; charset=utf-8");
  28.     } else {
  29.         return parent::dumpHeaders($identifier, $multi_table);
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement