/** * Outputs the XML contents of the export file * * @param $setHeaders * set to 0 if you don't want to send out headers * (optional, default 1) */ function export($setHeaders = 1) { if ($setHeaders) { // make sure the mimetype is correct, and that the data does not show up // in the browser, but gets saved into and XML file (popup download window) header('Content-Type: text/xml'); header('Content-Disposition: attachment; filename="skinbackup.xml"'); header('Expires: 0'); header('Pragma: no-cache'); } echo "<nucleusskin>\n"; // meta echo "\t<meta>\n"; // skins foreach ($this->skins as $skinId => $skinName) { $skinName = htmlspecialchars($skinName, ENT_QUOTES); if (strtoupper(_CHARSET) != 'UTF-8') { $skinName = mb_convert_encoding($skinName, 'UTF-8', _CHARSET); } echo "\t\t" . '<skin name="' . htmlspecialchars($skinName, ENT_QUOTES) . '" />' . "\n"; } // templates foreach ($this->templates as $templateId => $templateName) { $templateName = htmlspecialchars($templateName, ENT_QUOTES); if (strtoupper(_CHARSET) != 'UTF-8') { $templateName = mb_convert_encoding($templateName, 'UTF-8', _CHARSET); } echo "\t\t" . '<template name="' . htmlspecialchars($templateName, ENT_QUOTES) . '" />' . "\n"; } // extra info if ($this->info) { if (strtoupper(_CHARSET) != 'UTF-8') { $skin_info = mb_convert_encoding($this->info, 'UTF-8', _CHARSET); } else { $skin_info = $this->info; } echo "\t\t<info><![CDATA[" . $skin_info . "]]></info>\n"; } echo "\t</meta>\n\n\n"; // contents skins foreach ($this->skins as $skinId => $skinName) { $skinId = intval($skinId); $skinObj = new SKIN($skinId); $skinName = htmlspecialchars($skinName, ENT_QUOTES); $contentT = htmlspecialchars($skinObj->getContentType(), ENT_QUOTES); $incMode = htmlspecialchars($skinObj->getIncludeMode(), ENT_QUOTES); $incPrefx = htmlspecialchars($skinObj->getIncludePrefix(), ENT_QUOTES); $skinDesc = htmlspecialchars($skinObj->getDescription(), ENT_QUOTES); if (strtoupper(_CHARSET) != 'UTF-8') { $skinName = mb_convert_encoding($skinName, 'UTF-8', _CHARSET); $contentT = mb_convert_encoding($contentT, 'UTF-8', _CHARSET); $incMode = mb_convert_encoding($incMode, 'UTF-8', _CHARSET); $incPrefx = mb_convert_encoding($incPrefx, 'UTF-8', _CHARSET); $skinDesc = mb_convert_encoding($skinDesc, 'UTF-8', _CHARSET); } echo "\t" . '<skin name="' . $skinName . '" type="' . $contentT . '" includeMode="' . $incMode . '" includePrefix="' . $incPrefx . '">' . "\n"; echo "\t\t" . '<description>' . $skinDesc . '</description>' . "\n"; $que = 'SELECT' . ' stype,' . ' scontent ' . 'FROM ' . sql_table('skin') . ' WHERE' . ' sdesc = ' . $skinId; $res = sql_query($que); while ($partObj = sql_fetch_object($res)) { $type = htmlspecialchars($partObj->stype, ENT_QUOTES); $cdata = $this->escapeCDATA($partObj->scontent); if (strtoupper(_CHARSET) != 'UTF-8') { $type = mb_convert_encoding($type, 'UTF-8', _CHARSET); $cdata = mb_convert_encoding($cdata, 'UTF-8', _CHARSET); } echo "\t\t" . '<part name="' . $type . '">'; echo '<![CDATA[' . $cdata . ']]>'; echo "</part>\n\n"; } echo "\t</skin>\n\n\n"; } // contents templates foreach ($this->templates as $templateId => $templateName) { $templateId = intval($templateId); $templateName = htmlspecialchars($templateName, ENT_QUOTES); $templateDesc = htmlspecialchars(TEMPLATE::getDesc($templateId), ENT_QUOTES); if (strtoupper(_CHARSET) != 'UTF-8') { $templateName = mb_convert_encoding($templateName, 'UTF-8', _CHARSET); $templateDesc = mb_convert_encoding($templateDesc, 'UTF-8', _CHARSET); } echo "\t" . '<template name="' . $templateName . '">' . "\n"; echo "\t\t" . '<description>' . $templateDesc . "</description>\n"; $que = 'SELECT' . ' tpartname,' . ' tcontent' . ' FROM ' . sql_table('template') . ' WHERE' . ' tdesc = ' . $templateId; $res = sql_query($que); while ($partObj = sql_fetch_object($res)) { $type = htmlspecialchars($partObj->tpartname, ENT_QUOTES); $cdata = $this->escapeCDATA($partObj->tcontent); if (strtoupper(_CHARSET) != 'UTF-8') { $type = mb_convert_encoding($type, 'UTF-8', _CHARSET); $cdata = mb_convert_encoding($cdata, 'UTF-8', _CHARSET); } echo "\t\t" . '<part name="' . $type . '">'; echo '<![CDATA[' . $cdata . ']]>'; echo '</part>' . "\n\n"; } echo "\t</template>\n\n\n"; } echo '</nucleusskin>'; }