archive: renamed createzip.cgi to archive.zip. allow rules in the archive and append .rule if the file is a rule and .cfg otherwise.

This commit is contained in:
Daniel Marjamäki 2013-07-26 11:21:42 +02:00
parent 44333f316a
commit be11c47b82
2 changed files with 7 additions and 5 deletions

View File

@ -20,16 +20,18 @@ int main()
int first = 1; int first = 1;
char line[MAX_LINE_LEN] = {0}; char line[MAX_LINE_LEN] = {0};
while (fgets(line,sizeof(line)-2,f)) { while (fgets(line,sizeof(line)-2,f)) {
char name[MAX_NAME_LEN+10];
sprintf(name, "cfg/%s.cfg", getname(line));
char data[MAX_LINE_LEN] = {0}; char data[MAX_LINE_LEN] = {0};
unencode(line,data); unencode(line,data);
const char *xmldata = strstr(data, "&data="); const char *xmldata = strstr(data, "&data=");
xmldata = xmldata ? (xmldata + 6) : ""; xmldata = xmldata ? (xmldata + 6) : "";
char name[MAX_NAME_LEN+20];
if (strstr(xmldata, "<rule>"))
sprintf(name, "archive/%s.rule", getname(line));
else
sprintf(name, "archive/%s.cfg", getname(line));
if (first == 1) { if (first == 1) {
int status = 1;
first = 0; first = 0;
if (!mz_zip_writer_init_file(&zip_archive, ALL_ZIP, 0)) { if (!mz_zip_writer_init_file(&zip_archive, ALL_ZIP, 0)) {

View File

@ -45,7 +45,7 @@ uninitialized variables, unused functions" />
<? virtual('../cgi-bin/report.cgi') ?> <? virtual('../cgi-bin/report.cgi') ?>
<p><a href="/cgi-bin/createzip.cgi">Download all</a></p> <p><a href="/cgi-bin/archive.zip">Download all</a></p>
</div> <!-- .wrap --> </div> <!-- .wrap -->
</div> <!-- #content --> </div> <!-- #content -->
</body> </body>