Changeset 34859
- Timestamp:
- 07/18/15 11:40:41 (8 years ago)
- Location:
- titan
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/doc/htmlapi.txt
r33674 r34859 351 351 descr: returns command output 352 352 param: yes 353 example: queryraw?getcommand& free354 example: queryraw?getcommand& df%02-h353 example: queryraw?getcommand&cmd=free 354 example: queryraw?getcommand&cmd=df%02-h 355 355 356 356 query: webgethelp -
titan/titan/httpd.h
r34849 r34859 276 276 m_unlock(&status.waitrcmutex, 24); 277 277 } 278 else if( ostrcmp(query, "getcommand") == 0 && param != NULL)278 else if((ostrcmp(query, "getcommand") == 0 || ostrcmp(query, "getcommand=") == 0)) 279 279 { 280 280 m_lock(&status.waitrcmutex, 24); 281 281 buf = webgetcommand(param, fmt); 282 m_unlock(&status.waitrcmutex, 24); 282 m_unlock(&status.waitrcmutex, 24); 283 283 } 284 284 else if(ostrcmp(query, "getsystem") == 0 && param != NULL) … … 332 332 else if(ostrcmp(query, "gettpkupgrade") == 0) 333 333 buf = webgettpkupgrade(fmt); 334 else if(ostrcmp(query, "gettelnet") == 0) 335 buf = webgettelnet(fmt); 334 336 else if(ostrcmp(query, "getbackup") == 0) 335 337 buf = webgetbackup(fmt); -
titan/titan/httpdfunc.h
r34855 r34859 5053 5053 } 5054 5054 5055 char* webgetcommand(char* param, int fmt)5056 {5057 char* buf = NULL, *tmpstr = NULL;5058 if(param == NULL) return NULL;5059 if(status.security == 0) return NULL;5060 5061 // if(fmt == 0)5062 // {5063 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);5064 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);5065 buf = ostrcat(buf, "</head><body class=body id=\"command\"><center>", 1, 0);5066 // }5067 5068 debug(10, "cmd: %s", param);5069 tmpstr = command(param);5070 buf = ostrcat(buf, tmpstr, 1, 0);5071 free(tmpstr), tmpstr = NULL;5072 5073 buf = string_replace_all("\n", "<br>", buf, 1);5074 buf = string_replace_all("<br>", "<br>\n", buf, 1);5075 5076 // if(fmt == 0)5077 buf = ostrcat(buf, "</center></body></html>", 1, 0);5078 5079 return buf;5080 }5081 5082 5055 char* webgetsystem(char* param, int fmt) 5083 5056 { … … 6983 6956 return buf; 6984 6957 } 6985 6958 6959 char* webgettelnet(int fmt) 6960 { 6961 char* buf = NULL, *tmpstr = NULL; 6962 if(status.security == 0) return NULL; 6963 6964 // if(fmt == 0) 6965 // { 6966 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0); 6967 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0); 6968 buf = ostrcat(buf, "</head><body class=body id=\"command\"><center>", 1, 0); 6969 // } 6970 6971 buf = ostrcat(buf, "<form action=query method=get>", 1, 0); 6972 buf = ostrcat(buf, "<br><br>", 1, 0); 6973 buf = ostrcat(buf, "<div class=label>", 1, 0); 6974 buf = ostrcat(buf, _("Send Telnet Command"), 1, 0); 6975 buf = ostrcat(buf, "</div>", 1, 0); 6976 6977 buf = ostrcat(buf, "<br><br>", 1, 0); 6978 buf = ostrcat(buf, "<input hidden class=inputbox name=getcommand>", 1, 0); 6979 // buf = ostrcat(buf, "<input hidden class=inputbox name=play>", 1, 0); 6980 buf = ostrcat(buf, "<input class=inputbox style='width:360px' name=\"cmd\" style=\"overflow:hidden;\">", 1, 0); 6981 buf = ostrcat(buf, "<br><br>", 1, 0); 6982 buf = ostrcat(buf, "<input class=button type=submit value=\"", 1, 0); 6983 buf = ostrcat(buf, _("Send"), 1, 0); 6984 buf = ostrcat(buf, "\"></input>", 1, 0); 6985 6986 buf = ostrcat(buf, " ", 1, 0); 6987 buf = ostrcat(buf, "<input class=button type=reset name=reset value=\"", 1, 0); 6988 buf = ostrcat(buf, _("Reset"), 1, 0); 6989 buf = ostrcat(buf, "\"></input>", 1, 0); 6990 6991 buf = ostrcat(buf, "</form>", 1, 0); 6992 6993 6994 // debug(10, "cmd: %s", param); 6995 // tmpstr = command(param); 6996 buf = ostrcat(buf, tmpstr, 1, 0); 6997 free(tmpstr), tmpstr = NULL; 6998 6999 buf = string_replace_all("\n", "<br>", buf, 1); 7000 buf = string_replace_all("<br>", "<br>\n", buf, 1); 7001 7002 // if(fmt == 0) 7003 buf = ostrcat(buf, "</center></body></html>", 1, 0); 7004 7005 return buf; 7006 } 7007 7008 char* webgetcommand(char* param, int fmt) 7009 { 7010 char* buf = NULL, *tmpstr = NULL, *cmd = NULL; 7011 if(param == NULL) return NULL; 7012 if(status.security == 0) return NULL; 7013 7014 cmd = ostrcat(param + 4, NULL, 0, 0); 7015 7016 if(cmd == NULL) return NULL; 7017 htmldecode(cmd, cmd); 7018 cmd = string_replace_all("+", " ", cmd, 1); 7019 7020 // if(fmt == 0) 7021 // { 7022 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0); 7023 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0); 7024 buf = ostrcat(buf, "</head><body class=body id=\"command\"><center>", 1, 0); 7025 buf = ostrcat(buf, "<br>", 1, 0); 7026 buf = ostrcat(buf, "<h1>", 1, 0); 7027 buf = ostrcat(buf, cmd, 1, 0); 7028 buf = ostrcat(buf, "</h1>", 1, 0); 7029 // } 7030 7031 buf = ostrcat(buf, "<br><br>", 1, 0); 7032 7033 debug(10, "cmd: %s", cmd); 7034 tmpstr = command(cmd); 7035 printf("webgetcommand: tmpstr: %s\n", tmpstr); 7036 7037 buf = ostrcat(buf, tmpstr, 1, 0); 7038 free(tmpstr), tmpstr = NULL; 7039 free(cmd), cmd = NULL; 7040 7041 buf = string_replace_all("\n", "<br>", buf, 1); 7042 buf = string_replace_all("<br>", "<br>\n", buf, 1); 7043 7044 // if(fmt == 0) 7045 buf = ostrcat(buf, "</center></body></html>", 1, 0); 7046 7047 return buf; 7048 } 7049 6986 7050 #endif
Note: See TracChangeset
for help on using the changeset viewer.