Changeset 5207 for trunk/oscam-http.c
- Timestamp:
- 05/09/11 20:48:56 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oscam-http.c
r5201 r5207 407 407 408 408 char *value = mk_t_cccam_port(); 409 tpl_ printf(vars, TPLAPPEND, "PORT", "%s", value);409 tpl_addVar(vars, TPLAPPEND, "PORT", value); 410 410 free_mk_t(value); 411 411 … … 537 537 free_mk_t(value); 538 538 539 tpl_ printf(vars, TPLADD, "HTTPDYNDNS", "%s",cfg.http_dyndns);539 tpl_addVar(vars, TPLADD, "HTTPDYNDNS", (char*)cfg.http_dyndns); 540 540 541 541 //Monlevel selector … … 574 574 char delimiter[2]; delimiter[0] = 1; delimiter[1] = '\0'; 575 575 for(ptr = strtok_r(sdevice, delimiter, &saveptr1); ptr; ptr = strtok_r(NULL, delimiter, &saveptr1)){ 576 tpl_ printf(vars, TPLADD, "SERIALDEVICE", "%s", ptr);576 tpl_addVar(vars, TPLADD, "SERIALDEVICE", ptr); 577 577 tpl_addVar(vars, TPLAPPEND, "DEVICES", tpl_getTpl(vars, "CONFIGSERIALDEVICEBIT")); 578 578 } 579 579 } 580 580 581 tpl_ printf(vars, TPLADD, "SERIALDEVICE", "%s", "");581 tpl_addVar(vars, TPLADD, "SERIALDEVICE", ""); 582 582 tpl_addVar(vars, TPLAPPEND, "DEVICES", tpl_getTpl(vars, "CONFIGSERIALDEVICEBIT")); 583 583 … … 932 932 tpl_addVar(vars, TPLADD, "ENABLED", "checked"); 933 933 934 tpl_ printf(vars, TPLADD, "ACCOUNT", "%s", rdr->r_usr);935 tpl_ printf(vars, TPLADD, "PASSWORD", "%s", rdr->r_pwd);934 tpl_addVar(vars, TPLADD, "ACCOUNT", rdr->r_usr); 935 tpl_addVar(vars, TPLADD, "PASSWORD", rdr->r_pwd); 936 936 937 937 for (i=0; i<14; i++) … … 985 985 986 986 value = mk_t_ecmwhitelist(rdr->ecmWhitelist); 987 tpl_ printf(vars, TPLADD, "ECMWHITELIST", "%s", value);987 tpl_addVar(vars, TPLADD, "ECMWHITELIST", value); 988 988 free_mk_t(value); 989 989 … … 994 994 tpl_printf(vars, TPLADD, "DETECT", "!%s", RDR_CD_TXT[rdr->detect&0x7f]); 995 995 else 996 tpl_ printf(vars, TPLADD, "DETECT", "%s", RDR_CD_TXT[rdr->detect&0x7f]);996 tpl_addVar(vars, TPLADD, "DETECT", RDR_CD_TXT[rdr->detect&0x7f]); 997 997 998 998 tpl_printf(vars, TPLADD, "MHZ", "%d", rdr->mhz); 999 999 tpl_printf(vars, TPLADD, "CARDMHZ", "%d", rdr->cardmhz); 1000 1000 1001 tpl_ printf(vars, TPLADD, "DEVICE", "%s", rdr->device);1001 tpl_addVar(vars, TPLADD, "DEVICE", rdr->device); 1002 1002 if(rdr->r_port) 1003 1003 tpl_printf(vars, TPLAPPEND, "DEVICE", ",%d", rdr->r_port); … … 1011 1011 //group 1012 1012 value = mk_t_group(rdr->grp); 1013 tpl_ printf(vars, TPLADD, "GRP", "%s", value);1013 tpl_addVar(vars, TPLADD, "GRP", value); 1014 1014 free_mk_t(value); 1015 1015 … … 1045 1045 //ident 1046 1046 value = mk_t_ftab(&rdr->ftab); 1047 tpl_ printf(vars, TPLADD, "IDENTS", "%s", value);1047 tpl_addVar(vars, TPLADD, "IDENTS", value); 1048 1048 free_mk_t(value); 1049 1049 1050 1050 //CHID 1051 1051 value = mk_t_ftab(&rdr->fchid); 1052 tpl_ printf(vars, TPLADD, "CHIDS", "%s", value);1052 tpl_addVar(vars, TPLADD, "CHIDS", value); 1053 1053 free_mk_t(value); 1054 1054 1055 1055 //class 1056 CLASSTAB *clstab = &rdr->cltab; 1057 char *dot=""; 1058 for(i = 0; i < clstab->an; ++i) { 1059 tpl_printf(vars, TPLAPPEND, "CLASS", "%s%02x", dot, (int)clstab->aclass[i]); 1060 dot=","; 1061 } 1062 1063 for(i = 0; i < clstab->bn; ++i) { 1064 tpl_printf(vars, TPLADD, "CLASS", "%s!%02x", dot, (int)clstab->bclass[i]); 1065 dot=","; 1066 } 1056 value = mk_t_cltab(&rdr->cltab); 1057 tpl_addVar(vars, TPLADD, "CLASS", value); 1058 free_mk_t(value); 1067 1059 1068 1060 if (rdr->show_cls) … … 1223 1215 1224 1216 if (!apicall){ 1225 tpl_ printf(vars, TPLADD, "LABEL", "%s", rdr->label);1226 tpl_ printf(vars, TPLADD, "ENCODEDLABEL", "%s", urlencode(vars, rdr->label));1217 tpl_addVar(vars, TPLADD, "LABEL", rdr->label); 1218 tpl_addVar(vars, TPLADD, "ENCODEDLABEL", urlencode(vars, rdr->label)); 1227 1219 } else { 1228 tpl_ printf(vars, TPLADD, "READERNAME", "%s", rdr->label);1220 tpl_addVar(vars, TPLADD, "READERNAME", rdr->label); 1229 1221 } 1230 1222 … … 1240 1232 for (i=0; i<4; i++) { 1241 1233 tpl_addVar(vars, TPLADD, "EMMRESULT", "error"); 1242 tpl_ printf(vars, TPLADD, "EMMTYPE", "%s", ttxt[i]);1234 tpl_addVar(vars, TPLADD, "EMMTYPE", ttxt[i]); 1243 1235 tpl_printf(vars, TPLADD, "EMMCOUNT", "%d", rdr->emmerror[i]); 1244 1236 tpl_addVar(vars, TPLAPPEND, "EMMSTATS", tpl_getTpl(vars, "APIREADERSTATSEMMBIT")); … … 1249 1241 for (i=0; i<4; i++) { 1250 1242 tpl_addVar(vars, TPLADD, "EMMRESULT", "written"); 1251 tpl_ printf(vars, TPLADD, "EMMTYPE", "%s", ttxt[i]);1243 tpl_addVar(vars, TPLADD, "EMMTYPE", ttxt[i]); 1252 1244 tpl_printf(vars, TPLADD, "EMMCOUNT", "%d", rdr->emmwritten[i]); 1253 1245 tpl_addVar(vars, TPLAPPEND, "EMMSTATS", tpl_getTpl(vars, "APIREADERSTATSEMMBIT")); … … 1258 1250 for (i=0; i<4; i++) { 1259 1251 tpl_addVar(vars, TPLADD, "EMMRESULT", "skipped"); 1260 tpl_ printf(vars, TPLADD, "EMMTYPE", "%s", ttxt[i]);1252 tpl_addVar(vars, TPLADD, "EMMTYPE", ttxt[i]); 1261 1253 tpl_printf(vars, TPLADD, "EMMCOUNT", "%d", rdr->emmskipped[i]); 1262 1254 tpl_addVar(vars, TPLAPPEND, "EMMSTATS", tpl_getTpl(vars, "APIREADERSTATSEMMBIT")); … … 1267 1259 for (i=0; i<4; i++) { 1268 1260 tpl_addVar(vars, TPLADD, "EMMRESULT", "blocked"); 1269 tpl_ printf(vars, TPLADD, "EMMTYPE", "%s", ttxt[i]);1261 tpl_addVar(vars, TPLADD, "EMMTYPE", ttxt[i]); 1270 1262 tpl_printf(vars, TPLADD, "EMMCOUNT", "%d", rdr->emmblocked[i]); 1271 1263 tpl_addVar(vars, TPLAPPEND, "EMMSTATS", tpl_getTpl(vars, "APIREADERSTATSEMMBIT")); … … 1295 1287 if (!apicall) { 1296 1288 tpl_printf(vars, TPLADD, "CHANNEL", "%04X:%06lX:%04X", stat->caid, stat->prid, stat->srvid); 1297 tpl_ printf(vars, TPLADD, "CHANNELNAME","%s", xml_encode(vars, get_servicename(cur_client(), stat->srvid, stat->caid)));1289 tpl_addVar(vars, TPLADD, "CHANNELNAME", xml_encode(vars, get_servicename(cur_client(), stat->srvid, stat->caid))); 1298 1290 tpl_printf(vars, TPLADD, "ECMLEN","%04hX", stat->ecmlen); 1299 tpl_ printf(vars, TPLADD, "RC", "%s", stxt[stat->rc]);1291 tpl_addVar(vars, TPLADD, "RC", stxt[stat->rc]); 1300 1292 tpl_printf(vars, TPLADD, "TIME", "%dms", stat->time_avg); 1301 1293 if (stat->time_stat[stat->time_idx]) … … 1320 1312 tpl_printf(vars, TPLADD, "ECMTIMELAST", "%d", stat->time_stat[stat->time_idx]); 1321 1313 tpl_printf(vars, TPLADD, "ECMRC", "%d", stat->rc); 1322 tpl_ printf(vars, TPLADD, "ECMRCS", "%s", stxt[stat->rc]);1314 tpl_addVar(vars, TPLADD, "ECMRCS", stxt[stat->rc]); 1323 1315 if(stat->last_received) { 1324 1316 char tbuffer [30]; … … 1533 1525 //ident 1534 1526 value = mk_t_ftab(&account->ftab); 1535 tpl_ printf(vars, TPLADD, "IDENTS", "%s", value);1527 tpl_addVar(vars, TPLADD, "IDENTS", value); 1536 1528 free_mk_t(value); 1537 1529 1538 1530 //CHID 1539 1531 value = mk_t_ftab(&account->fchid); 1540 tpl_printf(vars, TPLADD, "CHIDS", "%s", value); 1532 tpl_addVar(vars, TPLADD, "CHIDS", value); 1533 free_mk_t(value); 1534 1535 //class 1536 value = mk_t_cltab(&account->cltab); 1537 tpl_addVar(vars, TPLADD, "CLASS", value); 1541 1538 free_mk_t(value); 1542 1539 … … 2283 2280 char tbuffer [30]; 2284 2281 strftime(tbuffer, 30, "%Y-%m-%dT%H:%M:%S%z", <); 2285 tpl_ printf(vars, TPLADD, "CLIENTLOGINDATE", "%s", tbuffer);2282 tpl_addVar(vars, TPLADD, "CLIENTLOGINDATE", tbuffer); 2286 2283 tpl_printf(vars, TPLADD, "CLIENTLOGINSECS", "%d", lsec); 2287 2284 } … … 2461 2458 } else { 2462 2459 if (strcmp(getParam(params, "appendlog"), "1") == 0) 2463 tpl_ printf(vars, TPLAPPEND, "LOGHISTORY", "%s", p_txt);2460 tpl_addVar(vars, TPLAPPEND, "LOGHISTORY", p_txt); 2464 2461 } 2465 2462 } … … 2723 2720 if (fp == NULL) { 2724 2721 tpl_addVar(vars, TPLADD, "USBENTRY", "Failed to run lusb"); 2725 tpl_ printf(vars, TPLADD, "USBENTRY", "%s", path);2722 tpl_addVar(vars, TPLADD, "USBENTRY", path); 2726 2723 tpl_addVar(vars, TPLAPPEND, "USBBIT", tpl_getTpl(vars, "SCANUSBBIT")); 2727 2724 err = 1; … … 2732 2729 tpl_addVar(vars, TPLADD, "USBENTRYCLASS", ""); 2733 2730 if (strstr(path,"Bus ")) { 2734 tpl_ printf(vars, TPLADD, "USBENTRY", "%s", path);2731 tpl_addVar(vars, TPLADD, "USBENTRY", path); 2735 2732 tpl_addVar(vars, TPLADD, "USBENTRYCLASS", "CLASS=\"scanusbsubhead\""); 2736 2733 } else { … … 2918 2915 while (fgets(buffer, sizeof(buffer), fp) != NULL) 2919 2916 if (!strcmp(getParam(params, "filter"), "all")) 2920 tpl_ printf(vars, TPLAPPEND, "FILECONTENT", "%s", buffer);2917 tpl_addVar(vars, TPLAPPEND, "FILECONTENT", buffer); 2921 2918 else 2922 2919 if(strstr(buffer,getParam(params, "filter"))) 2923 tpl_ printf(vars, TPLAPPEND, "FILECONTENT", "%s", buffer);2920 tpl_addVar(vars, TPLAPPEND, "FILECONTENT", buffer); 2924 2921 fclose (fp); 2925 2922 } else { … … 2971 2968 while ((v_ban_entry=ll_iter_next(itr))) { 2972 2969 2973 tpl_ printf(vars, TPLADD, "IPADDRESS", "%s", cs_inet_ntoa(v_ban_entry->v_ip));2970 tpl_addVar(vars, TPLADD, "IPADDRESS", cs_inet_ntoa(v_ban_entry->v_ip)); 2974 2971 2975 2972 struct tm st ; … … 3394 3391 char tbuffer [30]; 3395 3392 strftime(tbuffer, 30, "%Y-%m-%dT%H:%M:%S%z", &st); 3396 tpl_ printf(vars, TPLADD, "APISTARTTIME", "%s", tbuffer);3393 tpl_addVar(vars, TPLADD, "APISTARTTIME", tbuffer); 3397 3394 tpl_printf(vars, TPLADD, "APIUPTIME", "%u", now - first_client->login); 3398 3395 tpl_printf(vars, TPLADD, "APIREADONLY", "%d", cfg.http_readonly); … … 3406 3403 3407 3404 tpl_addVar(vars, TPLADD, "UPTIME", sec2timeformat(vars, (now - first_client->login))); 3408 tpl_ printf(vars, TPLADD, "CURIP", "%s", cs_inet_ntoa(addr));3405 tpl_addVar(vars, TPLADD, "CURIP", cs_inet_ntoa(addr)); 3409 3406 if(cfg.http_readonly) 3410 3407 tpl_addVar(vars, TPLAPPEND, "BTNDISABLED", "DISABLED");
Note:
See TracChangeset
for help on using the changeset viewer.