$jar['content/xmlhttprequester.js'] = $smarty->fetch('content--xmlhttprequester.js.tpl');
$jar['content/common/defaults.js'] = $smarty->fetch('content--common--defaults.js.tpl');
$jar['content/common/preferences.js'] = $smarty->fetch('content--common--preferences.js.tpl');
$jar['content/help.html'] = "";
$jar['content/options.js'] = $smarty->fetch('content--options.js.tpl');
$jar['content/options.xul'] = $smarty->fetch('content--options.xul.tpl');
$jar['locale/en-US/options.dtd'] = $smarty->fetch('locale--en-US--options.dtd.tpl');
$jar['locale/en-US/userscript.properties'] = $smarty->fetch('locale--en-US--userscript.properties.tpl');
$jar['skin/classic/options.css'] = $smarty->fetch('skin--classic--options.css.tpl');
if ($data['icon']) {
    $jar['skin/classic/icon.png'] = $iconcontents;
}
foreach ($GMSC['scriptfilenames'] as $script) {
    $jar['content/user_scripts/' . $script] = $GMSC['scripts'][$script];
}
unset($GMSC['scripts']);
//for efficiency
$zipjar = new CreateZip();
foreach ($jar as $k => $v) {
    $zipjar->addFile($v, $k);
}
$xpi['chrome/' . $data['shortname'] . ".jar"] = $zipjar->getZippedfile();
$xpi['chrome.manifest'] = $smarty->fetch('chrome.manifest-jar.tpl');
$xpi['install.rdf'] = $smarty->fetch('install.rdf.tpl');
$zipxpi = new CreateZip();
foreach ($xpi as $k => $v) {
    $zipxpi->addFile($v, $data['shortname'] . "/" . $k);
}
$myxpi = fopen($data['shortname'] . '_' . $data['version'] . '.xpi', 'wb');
fwrite($myxpi, $zipxpi->getZippedfile());
fclose($myxpi);
\t\t\t\t.setTimeout(function(){details[event](responseState);}, 0);
\t\t}
\t}
}
EOF;
    $xpi['content/' . $data['shortname'] . '.js'] = $_POST['script'] . "\n";
    //walk over the xpi array, and replace all our "variables"
    unset($_POST['script']);
    //for efficiency
    foreach (array_keys($xpi) as $k) {
        $xpi[$k] = insertValues($xpi[$k], $data);
    }
    $zip = new CreateZip();
    $zip->addDirectory('chrome/');
    foreach ($xpi as $k => $v) {
        $zip->addFile($v, $k);
    }
    $zip->forceDownload($data['shortname']);
    print_r($_FILES['script']);
} else {
    ?>
<!doctype html public '-//w3c//dtd xhtml 1.1//en' 'http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
<head>
<meta http-equiv='content-type' content='text/html; charset=UTF-8' />
<title>User Script Compiler</title>
<style type='text/css'>
body {
	font-family: Helvetica, Verdana, Sans-Serif;
}
input, textarea {