Changeset 4129
- Timestamp:
- 12/16/10 21:34:13 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oscam-http.c
r4128 r4129 1801 1801 } 1802 1802 1803 void send_oscam_status(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in ) {1803 void send_oscam_status(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in, int apicall) { 1804 1804 int i; 1805 1805 char *usr; … … 2060 2060 } 2061 2061 2062 // select right suborder 2063 if (cl->typ == 'c') { 2064 tpl_addVar(vars, 1, "CLIENTSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT")); 2065 tpl_printf(vars, 0, "CLIENTHEADLINE", "<TR><TD CLASS=\"subheadline\" colspan=\"17\">Clients %d/%d</TD></TR>\n", 2066 user_count_active, user_count_all); 2067 } 2068 else if (cl->typ == 'r') { 2069 tpl_addVar(vars, 1, "READERSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT")); 2070 tpl_printf(vars, 0, "READERHEADLINE", "<TR><TD CLASS=\"subheadline\" colspan=\"17\">Readers %d/%d</TD></TR>\n", 2071 reader_count_active, reader_count_all); 2072 } 2073 else if (cl->typ == 'p') { 2074 tpl_addVar(vars, 1, "PROXYSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT")); 2075 tpl_printf(vars, 0, "PROXYHEADLINE", "<TR><TD CLASS=\"subheadline\" colspan=\"17\">Proxies %d/%d</TD></TR>\n", 2076 proxy_count_active, proxy_count_all); 2077 } 2078 else 2079 tpl_addVar(vars, 1, "SERVERSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT")); 2062 if (!apicall){ 2063 // select right suborder 2064 if (cl->typ == 'c') { 2065 tpl_addVar(vars, 1, "CLIENTSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT")); 2066 tpl_printf(vars, 0, "CLIENTHEADLINE", "<TR><TD CLASS=\"subheadline\" colspan=\"17\">Clients %d/%d</TD></TR>\n", 2067 user_count_active, user_count_all); 2068 } 2069 else if (cl->typ == 'r') { 2070 tpl_addVar(vars, 1, "READERSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT")); 2071 tpl_printf(vars, 0, "READERHEADLINE", "<TR><TD CLASS=\"subheadline\" colspan=\"17\">Readers %d/%d</TD></TR>\n", 2072 reader_count_active, reader_count_all); 2073 } 2074 else if (cl->typ == 'p') { 2075 tpl_addVar(vars, 1, "PROXYSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT")); 2076 tpl_printf(vars, 0, "PROXYHEADLINE", "<TR><TD CLASS=\"subheadline\" colspan=\"17\">Proxies %d/%d</TD></TR>\n", 2077 proxy_count_active, proxy_count_all); 2078 } 2079 else 2080 tpl_addVar(vars, 1, "SERVERSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT")); 2081 2082 } else { 2083 tpl_addVar(vars, 1, "APISTATUSBITS", tpl_getTpl(vars, "APISTATUSBIT")); 2084 } 2080 2085 2081 2086 } … … 2097 2102 p_usr=(char *)(loghist+(i*CS_LOGHISTSIZE)); 2098 2103 p_txt=p_usr+32; 2099 if (p_txt[0]) tpl_printf(vars, 1, "LOGHISTORY", "<span class=\"%s\">%s</span><br>\n", p_usr, p_txt+8); 2104 2105 if (!apicall) { 2106 if (p_txt[0]) tpl_printf(vars, 1, "LOGHISTORY", "<span class=\"%s\">%s</span><br>\n", p_usr, p_txt+8); 2107 } else { 2108 tpl_printf(vars, 1, "LOGHISTORY", "%s", p_txt+8); 2109 } 2100 2110 } 2101 2111 #else … … 2108 2118 tpl_addVar(vars, 0, "SDEBUG", tpl_getTpl(vars, "DEBUGSELECT")); 2109 2119 2110 webif_write(tpl_getTpl(vars, "STATUS"), f); 2120 if(!apicall) 2121 webif_write(tpl_getTpl(vars, "STATUS"), f); 2122 else 2123 webif_write(tpl_getTpl(vars, "APISTATUS"), f); 2124 2111 2125 } 2112 2126 … … 2537 2551 2538 2552 webif_write(tpl_getTpl(vars, "FAILBAN"), f); 2553 } 2554 2555 void send_oscam_api(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 2556 if (strcmp(getParam(params, "part"), "status") == 0) { 2557 send_oscam_status(vars, f, params, in, 1); 2558 } 2539 2559 } 2540 2560 … … 2631 2651 "/readerstats.html", 2632 2652 "/failban.html", 2633 "/oscam.js"}; 2653 "/oscam.js", 2654 "/oscamapi.html"}; 2634 2655 2635 2656 int pagescnt = sizeof(pages)/sizeof(char *); // Calculate the amount of items in array … … 2775 2796 case 1: send_oscam_reader(vars, f, ¶ms, in); break; 2776 2797 case 2: send_oscam_entitlement(vars, f, ¶ms); break; 2777 case 3: send_oscam_status(vars, f, ¶ms, in ); break;2798 case 3: send_oscam_status(vars, f, ¶ms, in, 0); break; 2778 2799 case 4: send_oscam_user_config(vars, f, ¶ms, in); break; 2779 2800 case 5: send_oscam_reader_config(vars, f, ¶ms, in); break; … … 2789 2810 case 15: send_oscam_reader_stats(vars, f, ¶ms); break; 2790 2811 case 16: send_oscam_failban(vars, f, ¶ms); break; 2791 default: send_oscam_status(vars, f, ¶ms, in); break; 2812 //case 8: js file 2813 case 18: send_oscam_api(vars, f, ¶ms, in); break; 2814 default: send_oscam_status(vars, f, ¶ms, in, 0); break; 2792 2815 } 2793 2816 tpl_clear(vars); -
trunk/oscam-http.h
r4112 r4129 242 242 </DIV>" 243 243 244 #define TPLAPIHEADER "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\ 245 <oscam version=\"##CS_VERSION## build ###CS_SVN_VERSION##\" starttime=\"##STARTDATE## - ##STARTTIME##\">\n" 246 244 247 #define TPLFOOTER "\ 245 248 <BR><HR/><BR><DIV CLASS=\"footer\">\n\ … … 250 253 </BODY>\ 251 254 </HTML>" 255 256 #define TPLAPIFOOTER "</oscam>" 252 257 253 258 #define TPLREFRESH "\ … … 410 415 ##TPLFOOTER##" 411 416 417 #define TPLAPISTATUS "##TPLAPIHEADER##\n\ 418 <status>\n\ 419 ##APISTATUSBITS##\ 420 </status>\n\ 421 <log>\n\ 422 ##LOGHISTORY##\ 423 </log>\ 424 ##TPLAPIFOOTER##" 425 426 412 427 #define TPLCLIENTSTATUSBIT "\ 413 428 <TR class=\"##CLIENTTYPE##\">\n\ … … 430 445 <TD align=\"center\">##CLIENTCON##</TD>\n\ 431 446 </TR>\n" 447 448 449 #define TPLAPISTATUSBIT " <client type=\"##CLIENTTYPE##\" name=\"##CLIENTUSER##\" protocol=\"##CLIENTPROTO##\" protocolext=\"##CLIENTPROTOTITLE##\">\n\ 450 <request caid=\"##CLIENTCAID##\" srvid=\"##CLIENTSRVID##\">##CLIENTSRVPROVIDER####CLIENTSRVNAME##</request>\n\ 451 <times login=\"##CLIENTLOGINDATE##\" last=\"##CLIENTLOGINSECS##\" idle=\"##CLIENTIDLESECS##\"></times>\n\ 452 <connection ip=\"##CLIENTIP##\" port=\"##CLIENTPORT##\">##CLIENTCON##</connection>\n\ 453 </client>\n" 454 432 455 433 456 #define TPLUSERCONFIGLIST "\ … … 1334 1357 char *tpl[]={ 1335 1358 "HEADER", 1359 "APIHEADER", 1336 1360 "FOOTER", 1361 "APIFOOTER", 1337 1362 "MENU", 1338 1363 "REFRESH", 1339 1364 "STATUS", 1365 "APISTATUS", 1340 1366 "CLIENTSTATUSBIT", 1367 "APISTATUSBIT", 1341 1368 "USERCONFIGLIST", 1342 1369 "ADDNEWUSER", … … 1421 1448 char *tplmap[]={ 1422 1449 TPLHEADER, 1450 TPLAPIHEADER, 1423 1451 TPLFOOTER, 1452 TPLAPIFOOTER, 1424 1453 TPLMENU, 1425 1454 TPLREFRESH, 1426 1455 TPLSTATUS, 1456 TPLAPISTATUS, 1427 1457 TPLCLIENTSTATUSBIT, 1458 TPLAPISTATUSBIT, 1428 1459 TPLUSERCONFIGLIST, 1429 1460 TPLADDNEWUSER,
Note:
See TracChangeset
for help on using the changeset viewer.