function export() { $xml = makeXML(); print "<xmp>{$xml}</xmp>"; }
break; case 'function': case 'class': $extras[$k][$r] = $_POST[$el_name]; // switch ($extras[$k]['type']) break; } } } if (!isset($extras[$k]['file']) || !isset($extras[$k]['function']) || isset($extras[$k]['type']) && $extras[$k]['type'] == 'classFunction' && !isset($extras[$k]['class'])) { unset($extras[$k]); // Incomplete definition } } $message = LAN_XMLGEN_06 . e_PLUGIN . $_POST['selected_plugin'] . "<br />"; $message .= makeXML(e_PLUGIN . $_POST['selected_plugin'], $extras); } else { $message = LAN_XMLGEN_05; } } //======================================================== // FORM //======================================================== $text = "<div style='text-align:center; width:700px'>\n\t<form method='post' action='" . e_SELF . "'>\n\t<table style='width:95%' class='fborder'>\n\t<colgroup>\n\t<col style='width:60%' />\n\t<col style='width:40%' />\n\t</colgroup>"; if ($message) { $text .= "<tr>\n\t <td colspan='2' class='forumheader3' style='text-align:center'>" . $message . "\n\t </td>\n\t</tr>"; } $text .= "<tr>\n\t <td colspan='2' class='forumheader3' style='text-align:center'>" . LAN_XMLGEN_01 . "<br /><span class='smallblacktext'>" . LAN_XMLGEN_14 . "</span></td>\n\t</tr>\n\n\t<tr>\n\t <td class='forumheader3'>" . LAN_XMLGEN_04 . "</td>\n\t <td class='forumheader3'>" . genFileSelect('selected_plugin', $pluginList) . "\n\t </td>\n\t</tr>\n\n\t<tr>\n\t <td class='forumheader3'>" . LAN_XMLGEN_11 . "<br /><span class='smallblacktext'>" . LAN_XMLGEN_13 . "</span></td>\n\t <td class='forumheader3'>\n\t <input class='tbox' type='text' size='60' maxlength='100' name='copyright' value='' />\n\t </td>\n\t</tr>\n\n\t<tr>\n\t <td class='forumheader3'>" . LAN_XMLGEN_12 . "<br /><span class='smallblacktext'>" . LAN_XMLGEN_13 . "</span></td>\n\t <td class='forumheader3'>\n\t <input class='tbox' type='text' size='60' maxlength='150' name='update_url' value='' />\n\t </td>\n\t</tr>\n\n\t<tr>\n\t <td class='forumheader3'>" . LAN_XMLGEN_21 . "</td>\n\t <td class='forumheader3'>\n\t <select name='installationrequired'>\n\n\t <option value='1' selected='selected'>" . LAN_XMLGEN_23 . "</option>\n\n\t <option value='0'>" . LAN_XMLGEN_24 . "</option>\n\n\t </select>\n\t </td>\n\t</tr>\n\n\n\n\t<tr><td class='forumheader3'>" . LAN_XMLGEN_20 . "<br /><span class='smallblacktext'>" . LAN_XMLGEN_22 . "</span></td><td class='forumheader3'>\n\t\n\t<table>"; foreach ($managementOptions as $k => $v) { $text .= "<tr>"; foreach ($v as $r => $s) {
<?php require "../settings.php"; require "./parsexml.php"; header("Content-Type: application/octet-stream"); //header("Content-Length: ".strlen(makeXML() +11)."); header("Content-Transfer-Encoding: binary"); header("Content-Disposition: attachment; filename=\"replay-batch.xml\""); print makeXML();
$file2 = file_get_contents($argv[2]); $outputFileName = $argv[3]; //Grab the header block and the footer block from the first file. We aren't going to merge those. $foo = explode("<types>", $file1, 2); $header = trim($foo[0]); $bar = explode("<version>", $file1, 2); $footer = INDENT . '<version>' . trim($bar[1]); $xml1 = simplexml_load_string($file1); $xml2 = simplexml_load_string($file2); $arrNames = getNames($xml1, $xml2); //a sorted, unique, indexed array of all the metadata type names merged from both files //parse these into associative arrays where the key is the <name> value and the value is an indexed array of all the <member> values $arrXml1 = transformToArray($xml1); $arrXml2 = transformToArray($xml2); $arrMergeSort = mergeAndSort($arrNames, $arrXml1, $arrXml2); $xmlOut = makeXML($arrNames, $arrMergeSort, $header, $footer); file_put_contents($outputFileName, $xmlOut); } function makeXML($arrNames, $arrMergeSort, $header, $footer) { $xmlOut = ''; $xmlOut .= $header . NEWLINE; //loop through the names foreach ($arrNames as $name) { $xmlOut .= INDENT . '<types>' . NEWLINE; foreach ($arrMergeSort[$name] as $member) { $xmlOut .= INDENT . INDENT . '<members>' . $member . '</members>' . NEWLINE; } $xmlOut .= INDENT . INDENT . '<name>' . $name . '</name>' . NEWLINE; $xmlOut .= INDENT . '</types>' . NEWLINE; }