Changeset 2900 for branches/threaded/oscam-http.c
- Timestamp:
- 08/04/10 16:13:21 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/threaded/oscam-http.c
r2763 r2900 256 256 tpl_printf(vars, 1, "PORT", "%s%d@%04X", dot1, cfg->ncd_ptab.ports[i].s_port, cfg->ncd_ptab.ports[i].ftab.filts[0].caid); 257 257 258 if (cfg->ncd_ptab.ports[i].ftab.filts[0].nprids > 1) {258 if (cfg->ncd_ptab.ports[i].ftab.filts[0].nprids > 0) { 259 259 tpl_printf(vars, 1, "PORT", ":"); 260 260 dot2 = ""; … … 678 678 679 679 switch(reader[readeridx].typ) { 680 case R_MP35 : 681 ctyp = "mp35"; 682 isphysical = 1; 683 break; 680 684 case R_MOUSE : 681 685 ctyp = "mouse"; … … 802 806 clear_ftab(&reader[ridx].ftab); 803 807 reader[ridx].grp = 0; 808 reader[ridx].auprovid = 0; 804 809 for(i = 0; i < (*params).paramcount; ++i) { 805 810 if ((strcmp((*params).params[i], "reader")) && (strcmp((*params).params[i], "action"))) { … … 810 815 chk_reader((*params).params[i], (*params).values[i], &reader[ridx]); 811 816 } 817 //printf("param %s value %s\n",(*params).params[i], (*params).values[i]); 812 818 } 813 819 chk_reader("services", servicelabels, &reader[ridx]); … … 1041 1047 case R_DB2COM1: 1042 1048 case R_DB2COM2: 1049 case R_MP35: 1043 1050 case R_MOUSE : 1044 1051 tpl_addVar(vars, 0, "PROTOCOL", "mouse"); … … 1165 1172 //clear Betatunnel before it re-readed by chk_t 1166 1173 clear_tuntab(&account->ttab); 1174 //clear ident before it re-readed by chk_t 1175 clear_ftab(&account->ftab); 1167 1176 1168 1177 for(i=0;i<(*params).paramcount;i++) { … … 1620 1629 kill(atoi(getParam(params, "pid")), SIGQUIT); 1621 1630 1631 if (strcmp(getParam(params, "action"), "restart") == 0) 1632 for (i = 0; i < CS_MAXREADER; i++) 1633 if (reader[i].pid == atoi(getParam(params, "pid"))) 1634 send_restart_cardreader(i); 1635 1636 if (strcmp(getParam(params, "action"), "resetstat") == 0) 1637 for (i = 0; i < CS_MAXREADER; i++) 1638 if (reader[i].pid == atoi(getParam(params, "pid"))) 1639 send_clear_reader_stat(i); 1640 1622 1641 char *debuglvl = getParam(params, "debug"); 1623 1642 if(strlen(debuglvl) > 0) { … … 1651 1670 1652 1671 for (i=0; i<CS_MAXPID; i++) { 1672 1673 // Reset template variables 1674 tpl_addVar(vars, 0, "CLIENTLBVALUE",""); 1675 1653 1676 if (client[i].pid && client[i].wihidden != 1) { 1654 1677 … … 1661 1684 if (((client[i].typ=='r') || (client[i].typ=='p')) && (con=cs_idx2ridx(i))>=0) usr=reader[con].label; 1662 1685 1686 if (((client[i].typ!='r') || (client[i].typ!='p')) && (client[i].lastreader[0])) 1687 tpl_printf(vars, 0, "CLIENTLBVALUE", "%s", client[i].lastreader); 1688 1663 1689 if (client[i].dup) con=2; 1664 1690 else if ((client[i].tosleep) && (now-client[i].lastswitch>client[i].tosleep)) con=1; … … 1674 1700 tpl_printf(vars, 0, "HIDEIDX", "%d", i); 1675 1701 tpl_addVar(vars, 0, "HIDEICON", ICHID); 1676 if( (client[i].typ == 'c' || client[i].typ == 'r' || client[i].typ == 'p')&& !cfg->http_readonly) {1702 if(client[i].typ == 'c' && !cfg->http_readonly) { 1677 1703 tpl_printf(vars, 0, "CLIENTPID", "%d ", client[i].pid); 1678 1704 tpl_printf(vars, 1, "CLIENTPID", "<A HREF=\"status.html?action=kill&pid=%d\" TITLE=\"Kill this client\"><IMG SRC=\"%s\" ALT=\"Kill\" STYLE=\"float:right\"></A>", client[i].pid, ICKIL); 1679 } else { 1705 } 1706 else if((client[i].typ == 'r' || client[i].typ == 'p') && !cfg->http_readonly) { 1707 tpl_printf(vars, 0, "CLIENTPID", "%d ", client[i].pid); 1708 tpl_printf(vars, 1, "CLIENTPID", "<A HREF=\"status.html?action=restart&pid=%d\" TITLE=\"Restart this reader/ proxy\"><IMG SRC=\"%s\" ALT=\"Kill\" STYLE=\"float:right\"></A>", client[i].pid, ICKIL); 1709 } 1710 else { 1680 1711 tpl_printf(vars, 0, "CLIENTPID", "%d ", client[i].pid); 1681 1712 } … … 1706 1737 } 1707 1738 if(days == 0) 1708 tpl_printf(vars, 0, "CLIENTLOGINSECS", "%02d:%02d:%02d", hours, mins, secs);1739 tpl_printf(vars, 0, "CLIENTLOGINSECS", "%02d:%02d:%02d", hours, mins, secs); 1709 1740 else 1710 tpl_printf(vars, 0, "CLIENTLOGINSECS", "%02dd %02d:%02d:%02d", days, hours, mins, secs);1741 tpl_printf(vars, 0, "CLIENTLOGINSECS", "%02dd %02d:%02d:%02d", days, hours, mins, secs); 1711 1742 1712 1743 tpl_printf(vars, 0, "CLIENTCAID", "%04X", client[i].last_caid); … … 1726 1757 } 1727 1758 if (found == 1) 1728 break;1759 break; 1729 1760 else 1730 srvid = srvid->next;1761 srvid = srvid->next; 1731 1762 } 1732 1763 … … 1757 1788 } 1758 1789 if(days == 0) 1759 tpl_printf(vars, 0, "CLIENTIDLESECS", "%02d:%02d:%02d", hours, mins, secs);1790 tpl_printf(vars, 0, "CLIENTIDLESECS", "%02d:%02d:%02d", hours, mins, secs); 1760 1791 else 1761 tpl_printf(vars, 0, "CLIENTIDLESECS", "%02dd %02d:%02d:%02d", days, hours, mins, secs);1792 tpl_printf(vars, 0, "CLIENTIDLESECS", "%02dd %02d:%02d:%02d", days, hours, mins, secs); 1762 1793 if(con == 2) tpl_printf(vars, 0, "CLIENTCON", "Duplicate"); 1763 1794 else if (con == 1) tpl_printf(vars, 0, "CLIENTCON", "Sleep"); … … 1772 1803 if(reader[ridx].pid == client[i].pid) 1773 1804 { 1805 if (reader[ridx].lbvalue) 1806 tpl_printf(vars, 0, "CLIENTLBVALUE", "<A HREF=\"status.html?action=resetstat&pid=%d\" TITLE=\"Reset statistics for this reader/ proxy\">%d</A>", reader[ridx].pid, reader[ridx].lbvalue); 1807 1774 1808 switch(reader[ridx].card_status) 1775 1809 { 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1810 case NO_CARD: txt = "OFF"; break; 1811 case CARD_NEED_INIT: txt = "NEEDINIT"; break; 1812 case CARD_INSERTED: 1813 if (client[i].typ=='p') 1814 txt = "CONNECTED"; 1815 else 1816 txt = "CARDOK"; 1817 break; 1818 case CARD_FAILURE: txt = "ERROR"; break; 1819 default: txt = "UNDEF"; 1786 1820 } 1787 1821 } … … 1998 2032 char path[1035]; 1999 2033 2000 fp = popen("lsusb ", "r");2034 fp = popen("lsusb -v | egrep '^Bus|^ *iSerial|^ *iProduct'", "r"); 2001 2035 if (fp == NULL) { 2002 2036 tpl_addVar(vars, 0, "USBENTRY", "Failed to run lusb"); … … 2008 2042 if(!err) { 2009 2043 while (fgets(path, sizeof(path)-1, fp) != NULL) { 2010 tpl_printf(vars, 0, "USBENTRY", "%s", path); 2044 tpl_addVar(vars, 0, "USBENTRYCLASS", ""); 2045 if (strstr(path,"Bus ")) { 2046 tpl_printf(vars, 0, "USBENTRY", "%s", path); 2047 tpl_addVar(vars, 0, "USBENTRYCLASS", "CLASS=\"scanusbsubhead\""); 2048 } else { 2049 tpl_printf(vars, 0, "USBENTRY", " %s", path); 2050 } 2011 2051 tpl_addVar(vars, 1, "USBBIT", tpl_getTpl(vars, "SCANUSBBIT")); 2012 2052 } … … 2091 2131 2092 2132 tpl_printf(vars, 0, "SCLEAR", "<A HREF=\"files.html?part=userfile&clear=usrfile\">%s</A><BR><BR>\n", "Clear Log"); 2133 tpl_addVar(vars, 0, "FILTER", "<FORM ACTION=\"files.html\" method=\"get\">\n"); 2134 tpl_addVar(vars, 1, "FILTER", "<INPUT name=\"part\" type=\"hidden\" value=\"userfile\">\n"); 2135 tpl_addVar(vars, 1, "FILTER", "<SELECT name=\"filter\">\n"); 2136 tpl_printf(vars, 1, "FILTER", "<OPTION value=\"%s\">%s</OPTION>\n", "all", "all"); 2137 2138 struct s_auth *account = cfg->account; 2139 do { 2140 tpl_printf(vars, 1, "FILTER", "<OPTION value=\"%s\" %s>%s</OPTION>\n", account->usr, strcmp(getParam(params, "filter"), account->usr) ? "":"selected", account->usr); 2141 } while ((account = account->next) && (account->next != NULL)); 2142 2143 tpl_addVar(vars, 1, "FILTER", "</SELECT><input type=\"submit\" name=\"action\" value=\"Filter\" title=\"Filter for a specific user\"></FORM>\n"); 2093 2144 2094 2145 } … … 2105 2156 if((fp = fopen(targetfile,"r")) == NULL) return; 2106 2157 while (fgets(buffer, sizeof(buffer), fp) != NULL) 2107 tpl_printf(vars, 1, "FILECONTENT", "%s", buffer); 2158 if (!strcmp(getParam(params, "filter"), "all")) 2159 tpl_printf(vars, 1, "FILECONTENT", "%s", buffer); 2160 else 2161 if(strstr(buffer,getParam(params, "filter"))) 2162 tpl_printf(vars, 1, "FILECONTENT", "%s", buffer); 2108 2163 fclose (fp); 2109 2164 } else { … … 2132 2187 ok = 1; 2133 2188 } else { 2134 pthread_mutex_lock(&gethostbyname_lock); //gethostbyname ist NOT threadsafe! So we need a mutex-lock!2135 2189 struct hostent *rht; 2136 2190 struct sockaddr_in udp_sa; … … 2142 2196 ok = 1; 2143 2197 } 2144 pthread_mutex_unlock(&gethostbyname_lock); //gethostbyname ist NOT threadsafe! So we need a mutex-lock!2145 2198 } 2146 2199 }
Note:
See TracChangeset
for help on using the changeset viewer.