static void wo_shutdown(char *url) { parse_asp("shutdown.asp"); web_close(); sleep(1); kill(1, SIGQUIT); }
void wo_iptrestore(char *url) { if (rboot) { redirect("/ipt-daily.asp"); } else { parse_asp("error.asp"); } }
void wo_asp(char *path) { parse_asp(path); }
static void wo_nvcommit(char *url) { parse_asp("saved.asp"); web_close(); nvram_commit(); }
static void wo_tomato(char *url) { char *v; int i; int ajax; int nvset; const char *red; int commit; // _dprintf("tomato.cgi\n"); red = webcgi_safeget("_redirect", ""); if (!*red) send_header(200, NULL, mime_html, 0); commit = atoi(webcgi_safeget("_commit", "1")); ajax = atoi(webcgi_safeget("_ajax", "0")); nvset = atoi(webcgi_safeget("_nvset", "1")); if (nvset) { if (!save_variables(0)) { if (ajax) { web_printf("@msg:%s", resmsg_get()); } else { parse_asp("error.asp"); } return; } commit = save_variables(1) && commit; resmsg_set("設定已儲存."); } rboot = atoi(webcgi_safeget("_reboot", "0")); if (rboot) { parse_asp("reboot.asp"); } else { if (ajax) { web_printf("@msg:%s", resmsg_get()); } else if (atoi(webcgi_safeget("_moveip", "0"))) { parse_asp("saved-moved.asp"); } else if (!*red) { parse_asp("saved.asp"); } } if (commit) { _dprintf("commit from tomato.cgi\n"); if (!nvram_match("debug_nocommit", "1")) { nvram_commit(); } } if ((v = webcgi_get("_service")) != NULL) { if (!*red) { if (ajax) web_printf(" 某些服務已重新啟動..."); web_close(); } sleep(1); if (*v == '*') { kill(1, SIGHUP); } else if (*v != 0) { exec_service(v); } } for (i = atoi(webcgi_safeget("_sleep", "0")); i > 0; --i) sleep(1); if (*red) redirect(red); if (rboot) { web_close(); sleep(1); kill(1, SIGTERM); } }