Changeset 17744


Ignore:
Timestamp:
10/11/11 14:42:42 (20 months ago)
Author:
BrainSlayer
Message:

reduce codesize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/httpd/modules/broadcom.c

    r17659 r17744  
    195195        struct variable *tmp; 
    196196        static struct SIMPLEVAL simpleval[] = { 
    197                 {"WMEPARAM", "validate_wl_wme_params",0}, 
    198                 {"WMETXPARAM", "validate_wl_wme_tx_params",0}, 
    199                 {"WANIPADDR", "validate_wan_ipaddr",0}, 
    200                 {"MERGEREMOTEIP", "validate_remote_ip",0}, 
    201                 {"MERGEIPADDRS", "validate_merge_ipaddrs",0}, 
    202                 {"DNS", "validate_dns",0}, 
    203                 {"SAVEWDS", "save_wds",0}, 
    204                 {"DHCP", "dhcp_check",0}, 
    205                 {"STATICS", "validate_statics",0}, 
     197                {"WMEPARAM", "validate_wl_wme_params", 0}, 
     198                {"WMETXPARAM", "validate_wl_wme_tx_params", 0}, 
     199                {"WANIPADDR", "validate_wan_ipaddr", 0}, 
     200                {"MERGEREMOTEIP", "validate_remote_ip", 0}, 
     201                {"MERGEIPADDRS", "validate_merge_ipaddrs", 0}, 
     202                {"DNS", "validate_dns", 0}, 
     203                {"SAVEWDS", "save_wds", 0}, 
     204                {"DHCP", "dhcp_check", 0}, 
     205                {"STATICS", "validate_statics", 0}, 
    206206#ifdef HAVE_PORTSETUP 
    207                 {"PORTSETUP", "validate_portsetup",0}, 
    208 #endif 
    209                 {"REBOOT", "validate_reboot",0}, 
    210                 {"IPADDR", "validate_ipaddr",0}, 
    211                 {"STATICLEASES", "validate_staticleases",0}, 
     207                {"PORTSETUP", "validate_portsetup", 0}, 
     208#endif 
     209                {"REBOOT", "validate_reboot", 0}, 
     210                {"IPADDR", "validate_ipaddr", 0}, 
     211                {"STATICLEASES", "validate_staticleases", 0}, 
    212212#ifdef HAVE_CHILLILOCAL 
    213                 {"USERLIST", "validate_userlist",0}, 
     213                {"USERLIST", "validate_userlist", 0}, 
    214214#endif 
    215215#ifdef HAVE_RADLOCAL 
    216                 {"IRADIUSUSERLIST", "validate_iradius",0}, 
    217 #endif 
    218                 {"IPADDRS", "validate_ipaddrs",0}, 
    219                 {"NETMASK", "validate_netmask",0}, 
    220                 {"MERGENETMASK", "validate_merge_netmask",0}, 
    221                 {"WDS", "validate_wds",0}, 
    222                 {"STATICROUTE", "validate_static_route",0}, 
    223                 {"MERGEMAC", "validate_merge_mac",0}, 
    224                 {"FILTERPOLICY", "validate_filter_policy",0}, 
    225                 {"FILTERIPGRP", "validate_filter_ip_grp",0}, 
    226                 {"FILTERPORT", "validate_filter_port",0}, 
    227                 {"FILTERDPORTGRP", "validate_filter_dport_grp",0}, 
    228                 {"BLOCKEDSERVICE", "validate_blocked_service",0}, 
    229                 {"FILTERP2P", "validate_catchall",0}, 
    230                 {"FILTERMACGRP", "validate_filter_mac_grp",0}, 
    231                 {"FILTERWEB", "validate_filter_web",0}, 
    232                 {"WLHWADDRS", "validate_wl_hwaddrs",0}, 
    233                 {"FORWARDPROTO", "validate_forward_proto",0}, 
    234                 {"FORWARDSPEC", "validate_forward_spec",0}, 
    235                 {"PORTTRIGGER", "validate_port_trigger",0}, 
    236                 {"HWADDR", "validate_hwaddr",0}, 
    237                 {"HWADDRS", "validate_hwaddrs",0}, 
    238                 {"WLWEPKEY", "validate_wl_wep_key",0}, 
     216                {"IRADIUSUSERLIST", "validate_iradius", 0}, 
     217#endif 
     218                {"IPADDRS", "validate_ipaddrs", 0}, 
     219                {"NETMASK", "validate_netmask", 0}, 
     220                {"MERGENETMASK", "validate_merge_netmask", 0}, 
     221                {"WDS", "validate_wds", 0}, 
     222                {"STATICROUTE", "validate_static_route", 0}, 
     223                {"MERGEMAC", "validate_merge_mac", 0}, 
     224                {"FILTERPOLICY", "validate_filter_policy", 0}, 
     225                {"FILTERIPGRP", "validate_filter_ip_grp", 0}, 
     226                {"FILTERPORT", "validate_filter_port", 0}, 
     227                {"FILTERDPORTGRP", "validate_filter_dport_grp", 0}, 
     228                {"BLOCKEDSERVICE", "validate_blocked_service", 0}, 
     229                {"FILTERP2P", "validate_catchall", 0}, 
     230                {"FILTERMACGRP", "validate_filter_mac_grp", 0}, 
     231                {"FILTERWEB", "validate_filter_web", 0}, 
     232                {"WLHWADDRS", "validate_wl_hwaddrs", 0}, 
     233                {"FORWARDPROTO", "validate_forward_proto", 0}, 
     234                {"FORWARDSPEC", "validate_forward_spec", 0}, 
     235                {"PORTTRIGGER", "validate_port_trigger", 0}, 
     236                {"HWADDR", "validate_hwaddr", 0}, 
     237                {"HWADDRS", "validate_hwaddrs", 0}, 
     238                {"WLWEPKEY", "validate_wl_wep_key", 0}, 
    239239#ifdef HAVE_PPPOESERVER 
    240                 {"CHAPTABLE", "validate_chaps",0}, 
     240                {"CHAPTABLE", "validate_chaps", 0}, 
    241241#endif 
    242242#ifdef HAVE_MILKFISH 
    243                 {"MFSUBSCRIBERS", "validate_subscribers",0}, 
    244                 {"MFALIASES", "validate_aliases",0}, 
     243                {"MFSUBSCRIBERS", "validate_subscribers", 0}, 
     244                {"MFALIASES", "validate_aliases", 0}, 
    245245#endif 
    246246                {"RANGE", "validate_range", 2}, 
     
    316316                                                while (simpleval[scount].name != NULL) {        // 
    317317                                                        if (!stricmp(tmpstr, simpleval[scount].name)) { // 
    318 //                                                              fprintf(stderr,"match %s %s\n",tmpstr,tmp->name); 
     318//                                                              fprintf(stderr,"match %s %s\n",tmpstr,tmp->name); 
    319319                                                                tmp->validatename = simpleval[scount].validator;        // 
    320320                                                                int arglen = 0; 
     
    476476                char *argv[] = { "freeradius.clientcert" }; 
    477477                call_ej("do_pagehead", NULL, wp, 1, argv);      // thats dirty 
    478                 websWrite(wp, "</head>\n"); 
    479                 websWrite(wp, "<body>\n"); 
    480                 websWrite(wp, "<div id=\"main\">\n"); 
    481                 websWrite(wp, "<div id=\"contentsInfo\">\n"); 
    482                 websWrite(wp, "<h2>%s</h2>\n", 
    483                           live_translate("freeradius.clientcert")); 
    484                 websWrite(wp, 
    485                           "Error: please specify a value username and password\n"); 
    486                 websWrite(wp, "<div class=\"submitFooter\">\n"); 
    487                 websWrite(wp, "<script type=\"text/javascript\">\n"); 
    488                 websWrite(wp, "//<![CDATA[\n"); 
    489                 websWrite(wp, "submitFooterButton(0,0,0,0,0,1);\n"); 
    490                 websWrite(wp, "//]]>\n"); 
    491                 websWrite(wp, "</script>\n"); 
    492                 websWrite(wp, "</div>\n"); 
    493                 websWrite(wp, "</div>\n"); 
    494                 websWrite(wp, "</div>\n"); 
    495                 websWrite(wp, "</body>\n"); 
    496                 websWrite(wp, "</html>\n"); 
     478                websWrite(wp, "</head>\n" 
     479                          "<body>\n" 
     480                          "<div id=\"main\">\n" "<div id=\"contentsInfo\">\n" 
     481                          "<h2>%s</h2>\n" 
     482                          "Error: please specify a value username and password\n" 
     483                          "<div class=\"submitFooter\">\n" 
     484                          "<script type=\"text/javascript\">\n" 
     485                          "//<![CDATA[\n" 
     486                          "submitFooterButton(0,0,0,0,0,1);\n" 
     487                          "//]]>\n" 
     488                          "</script>\n" 
     489                          "</div>\n" 
     490                          "</div>\n" 
     491                          "</div>\n" 
     492                          "</body>\n" 
     493                          "</html>\n", live_translate("freeradius.clientcert")); 
    497494                goto out; 
    498495        } 
     
    599596                system(exec); 
    600597        } 
    601         char *argv[] = { "freeradius.clientcert" }; 
     598        char *argv[] = { 
     599                "freeradius.clientcert" 
     600        }; 
    602601        call_ej("do_pagehead", NULL, wp, 1, argv);      // thats dirty 
    603         websWrite(wp, "</head>\n"); 
    604         websWrite(wp, "<body>\n"); 
    605         websWrite(wp, "<div id=\"main\">\n"); 
    606         websWrite(wp, "<div id=\"contentsInfo\">\n"); 
    607         websWrite(wp, "<h2>%s</h2>\n", live_translate("freeradius.clientcert")); 
     602        websWrite(wp, "</head>\n" 
     603                  "<body>\n" 
     604                  "<div id=\"main\">\n" 
     605                  "<div id=\"contentsInfo\">\n" 
     606                  "<h2>%s</h2>\n", live_translate("freeradius.clientcert")); 
    608607        sprintf(filename, "%s-cert.pem", db->users[radiusindex].user); 
    609608        show_certfield(wp, "Certificate PEM", filename); 
     
    614613        sprintf(filename, "%s-key.pem", db->users[radiusindex].user); 
    615614        show_certfield(wp, "Private Key PEM", filename); 
    616         websWrite(wp, "<div class=\"submitFooter\">\n"); 
    617         websWrite(wp, "<script type=\"text/javascript\">\n"); 
    618         websWrite(wp, "//<![CDATA[\n"); 
    619         websWrite(wp, "submitFooterButton(0,0,0,0,0,1);\n"); 
    620         websWrite(wp, "//]]>\n"); 
    621         websWrite(wp, "</script>\n"); 
    622         websWrite(wp, "</div>\n"); 
    623         websWrite(wp, "</div>\n"); 
    624         websWrite(wp, "</div>\n"); 
    625         websWrite(wp, "</body>\n"); 
    626         websWrite(wp, "</html>\n"); 
     615        websWrite(wp, "<div class=\"submitFooter\">\n" 
     616                  "<script type=\"text/javascript\">\n" 
     617                  "//<![CDATA[\n" 
     618                  "submitFooterButton(0,0,0,0,0,1);\n" 
     619                  "//]]>\n" 
     620                  "</script>\n" 
     621                  "</div>\n" "</div>\n" "</div>\n" "</body>\n" "</html>\n"); 
    627622 
    628623        //make certificates 
     
    841836        REFRESH, 
    842837}; 
    843  
    844838static struct gozila_action gozila_actions[] = { 
    845839        /* 
     
    10841078 
    10851079char my_next_page[30] = ""; 
    1086 int 
    1087 gozila_cgi(webs_t wp, char_t * urlPrefix, char_t * webDir, int arg, 
    1088            char_t * url, char_t * path, char_t * query) 
     1080int gozila_cgi(webs_t wp, char_t * urlPrefix, char_t * webDir, int arg, 
     1081               char_t * url, char_t * path, char_t * query) 
    10891082{ 
    10901083        char *submit_button, *submit_type, *next_page; 
     
    12691262                } 
    12701263        } 
    1271  
    12721264        return NULL; 
    12731265} 
     
    12871279{ 
    12881280        send_authenticate(auth_realm); 
    1289 } 
    1290  
    1291 static char *getdisc(void)      // works only for squashfs  
     1281} static char *getdisc(void)    // works only for squashfs  
    12921282{ 
    12931283        int i; 
    12941284        static char ret[4]; 
    1295         unsigned char *disks[] = 
    1296             { "sda2", "sdb2", "sdc2", "sdd2", "sde2", "sdf2", "sdg2", "sdh2", 
     1285        unsigned char *disks[] = { 
     1286                "sda2", "sdb2", "sdc2", "sdd2", "sde2", "sdf2", "sdg2", "sdh2", 
    12971287                "sdi2" 
    12981288        }; 
     
    13471337 
    13481338  /***************************************************************************/ 
    1349  
    13501339        if (!query) { 
    13511340                goto footer; 
     
    16871676} 
    16881677#endif 
    1689  
    16901678#ifdef HAVE_ROUTERSTYLE 
    16911679static void do_stylecss(struct mime_handler *handler, char *url, 
     
    16981686 
    16991687        long sdata[30]; 
    1700  
    1701         long blue[30] = 
    1702             { 0x36f, 0xfff, 0x68f, 0x24d, 0x24d, 0x68f, 0x57f, 0xccf, 0x78f, 
     1688        memset(sdata,0, sizeof(sdata)); 
     1689        long blue[30] = { 
     1690                0x36f, 0xfff, 0x68f, 0x24d, 0x24d, 0x68f, 0x57f, 0xccf, 0x78f, 
    17031691                0x35d, 
    17041692                0x35c, 0x78f, 
    1705                 0x78f, 0xfff, 0x9af, 0x46e, 0x46e, 0x9af, 0x36f, 0xccf, 0xfff, 
    1706                 0x69f, 
    1707                 0xfff, 0xfff, 
    1708                 0x999, 0x69f, 0x69f, 0xccf, 0x78f, 0xfff 
     1693                0x78f, 0xfff, 0x9af, 0x46e, 0x46e, 0x9af, 0x36f, 
     1694                0xccf, 0xfff, 0x69f, 0xfff, 0xfff, 0x999, 0x69f, 
     1695                0x69f, 0xccf, 0x78f, 0xfff 
    17091696        }; 
    17101697 
    1711         long cyan[30] = 
    1712             { 0x099, 0xfff, 0x3bb, 0x066, 0x066, 0x3bb, 0x3bb, 0xcff, 0x4cc, 
     1698        long cyan[30] = { 
     1699                0x099, 0xfff, 0x3bb, 0x066, 0x066, 0x3bb, 0x3bb, 0xcff, 0x4cc, 
    17131700                0x1aa, 
    17141701                0x1aa, 0x4cc, 
    1715                 0x6cc, 0xfff, 0x8dd, 0x5bb, 0x5bb, 0x8dd, 0x099, 0xcff, 0xfff, 
    1716                 0x3bb, 
    1717                 0xfff, 0xfff, 
    1718                 0x999, 0x3bb, 0x3bb, 0xcff, 0x6cc, 0xfff 
     1702                0x6cc, 0xfff, 0x8dd, 0x5bb, 0x5bb, 0x8dd, 0x099, 
     1703                0xcff, 0xfff, 0x3bb, 0xfff, 0xfff, 0x999, 0x3bb, 
     1704                0x3bb, 0xcff, 0x6cc, 0xfff 
    17191705        }; 
    17201706 
    1721         long elegant[30] = 
    1722             { 0x30519c, 0xfff, 0x496fc7, 0x496fc7, 0x496fc7, 0x496fc7, 0x496fc7, 
    1723                 0xfff, 0x6384cf, 0x6384cf, 0x6384cf, 0x6384cf, 
    1724                 0x6384cf, 0xfff, 0x849dd9, 0x849dd9, 0x849dd9, 0x849dd9, 
    1725                 0x30519c, 
    1726                 0xfff, 
    1727                 0xfff, 0x496fc7, 0xfff, 0xfff, 
    1728                 0x999, 0x496fc7, 0x496fc7, 0xfff, 0x6384cf, 0xfff 
     1707        long elegant[30] = { 
     1708                0x30519c, 0xfff, 0x496fc7, 0x496fc7, 0x496fc7, 0x496fc7, 
     1709                0x496fc7, 0xfff, 0x6384cf, 0x6384cf, 0x6384cf, 
     1710                0x6384cf, 0x6384cf, 0xfff, 0x849dd9, 0x849dd9, 
     1711                0x849dd9, 0x849dd9, 0x30519c, 0xfff, 0xfff, 
     1712                0x496fc7, 0xfff, 0xfff, 0x999, 0x496fc7, 0x496fc7, 
     1713                0xfff, 0x6384cf, 0xfff 
    17291714        }; 
    17301715 
    1731         long green[30] = 
    1732             { 0x090, 0xfff, 0x3b3, 0x060, 0x060, 0x3b3, 0x3b3, 0xcfc, 0x4c4, 
     1716        long green[30] = { 
     1717                0x090, 0xfff, 0x3b3, 0x060, 0x060, 0x3b3, 0x3b3, 0xcfc, 0x4c4, 
    17331718                0x1a1, 
    17341719                0x1a1, 0x4c4, 
    1735                 0x6c6, 0xfff, 0x8d8, 0x5b5, 0x5b5, 0x8d8, 0x090, 0xcfc, 0xfff, 
    1736                 0x3b3, 
    1737                 0xfff, 0xfff, 
    1738                 0x999, 0x3b3, 0x3b3, 0xcfc, 0x6c6, 0xfff 
     1720                0x6c6, 0xfff, 0x8d8, 0x5b5, 0x5b5, 0x8d8, 0x090, 
     1721                0xcfc, 0xfff, 0x3b3, 0xfff, 0xfff, 0x999, 0x3b3, 
     1722                0x3b3, 0xcfc, 0x6c6, 0xfff 
    17391723        }; 
    17401724 
    1741         long orange[30] = 
    1742             { 0xf26522, 0xfff, 0xff8400, 0xff8400, 0xff8400, 0xff8400, 0xff8400, 
    1743                 0xfff, 0xfeb311, 0xfeb311, 0xfeb311, 0xfeb311, 
    1744                 0xff9000, 0xfff, 0xffa200, 0xffa200, 0xffa200, 0xffa200, 
    1745                 0xf26522, 
    1746                 0xfff, 
    1747                 0xfff, 0xff8400, 0xfff, 0xfff, 
    1748                 0x999, 0xff8400, 0xff8400, 0xfff, 0xff9000, 0xfff 
     1725        long orange[30] = { 
     1726                0xf26522, 0xfff, 0xff8400, 0xff8400, 0xff8400, 0xff8400, 
     1727                0xff8400, 0xfff, 0xfeb311, 0xfeb311, 0xfeb311, 
     1728                0xfeb311, 0xff9000, 0xfff, 0xffa200, 0xffa200, 
     1729                0xffa200, 0xffa200, 0xf26522, 0xfff, 0xfff, 
     1730                0xff8400, 0xfff, 0xfff, 0x999, 0xff8400, 0xff8400, 
     1731                0xfff, 0xff9000, 0xfff 
    17491732        }; 
    17501733 
    1751         long red[30] = 
    1752             { 0xc00, 0xfff, 0xe33, 0x800, 0x800, 0xe33, 0xd55, 0xfcc, 0xe77, 
     1734        long red[30] = { 
     1735                0xc00, 0xfff, 0xe33, 0x800, 0x800, 0xe33, 0xd55, 0xfcc, 0xe77, 
    17531736                0xc44, 
    17541737                0xc44, 0xe77, 
    1755                 0xe77, 0xfff, 0xf99, 0xd55, 0xd55, 0xf99, 0xc00, 0xfcc, 0xfff, 
    1756                 0xd55, 
    1757                 0xfff, 0xfff, 
    1758                 0x999, 0xd55, 0xd55, 0xfcc, 0xe77, 0xfff 
     1738                0xe77, 0xfff, 0xf99, 0xd55, 0xd55, 0xf99, 0xc00, 
     1739                0xfcc, 0xfff, 0xd55, 0xfff, 0xfff, 0x999, 0xd55, 
     1740                0xd55, 0xfcc, 0xe77, 0xfff 
    17591741        }; 
    17601742 
    1761         long yellow[30] = 
    1762             { 0xeec900, 0x000, 0xee3, 0x880, 0x880, 0xee3, 0xffd700, 0x660, 
     1743        long yellow[30] = { 
     1744                0xeec900, 0x000, 0xee3, 0x880, 0x880, 0xee3, 0xffd700, 0x660, 
    17631745                0xee7, 
    17641746                0xbb4, 
    17651747                0xbb4, 0xee7, 
    1766                 0xeec900, 0x000, 0xff9, 0xcc5, 0xcc5, 0xff9, 0xeec900, 0x660, 
    1767                 0x000, 
    1768                 0xffd700, 
    1769                 0x000, 0xfff, 
     1748                0xeec900, 0x000, 0xff9, 0xcc5, 0xcc5, 0xff9, 
     1749                0xeec900, 0x660, 0x000, 0xffd700, 0x000, 0xfff, 
    17701750                0x999, 0xffd700, 0xeec900, 0x660, 0xffd700, 0x000 
    17711751        }; 
    17721752 
    17731753        if (!strcmp(style, "blue")) 
    1774                 memcpy(sdata, blue, 30 * sizeof(long)); 
     1754                memcpy(sdata, blue, sizeof(blue)); 
    17751755        else if (!strcmp(style, "cyan")) 
    1776                 memcpy(sdata, cyan, 30 * sizeof(long)); 
     1756                memcpy(sdata, cyan, sizeof(cyan)); 
    17771757        else if (!strcmp(style, "yellow")) 
    1778                 memcpy(sdata, yellow, 30 * sizeof(long)); 
     1758                memcpy(sdata, yellow, sizeof(yellow)); 
    17791759        else if (!strcmp(style, "green")) 
    1780                 memcpy(sdata, green, 30 * sizeof(long)); 
     1760                memcpy(sdata, green, sizeof(green)); 
    17811761        else if (!strcmp(style, "orange")) 
    1782                 memcpy(sdata, orange, 30 * sizeof(long)); 
     1762                memcpy(sdata, orange, sizeof(orange)); 
    17831763        else if (!strcmp(style, "red")) 
    1784                 memcpy(sdata, red, 30 * sizeof(long)); 
     1764                memcpy(sdata, red, sizeof(red)); 
    17851765        else                    // default to elegant 
    1786                 memcpy(sdata, elegant, 30 * sizeof(long)); 
    1787  
    1788         websWrite(stream, "@import url(../common.css);\n"); 
    1789         websWrite(stream, "#menuSub,\n"); 
    1790         websWrite(stream, "#menuMainList li span,\n"); 
    1791         websWrite(stream, "#help h2 {\n"); 
    1792         websWrite(stream, "background:#%03x;\n", sdata[0]); 
     1766                memcpy(sdata, elegant, sizeof(elegant)); 
     1767 
     1768        websWrite(stream, 
     1769                  "@import url(../common.css);\n#menuSub,\n#menuMainList li span,\n#help h2 {\nbackground:#%03x;\n", 
     1770                  sdata[0]); 
    17931771        websWrite(stream, "color:#%03x;\n", sdata[1]); 
    1794         websWrite(stream, "border-color:#%03x #%03x #%03x #%03x;\n", sdata[2], 
    1795                   sdata[3], sdata[4], sdata[5]); 
    1796         websWrite(stream, "}\n"); 
    1797         websWrite(stream, "#menuSubList li a {\n"); 
     1772        websWrite(stream, 
     1773                  "border-color:#%03x #%03x #%03x #%03x;\n}\n#menuSubList li a {\n", 
     1774                  sdata[2], sdata[3], sdata[4], sdata[5]); 
    17981775        websWrite(stream, "background:#%03x;\n", sdata[6]); 
    17991776        websWrite(stream, "color:#%03x;\n", sdata[7]); 
    1800         websWrite(stream, "border-color:#%03x #%03x #%03x #%03x;\n", sdata[8], 
    1801                   sdata[9], sdata[10], sdata[11]); 
    1802         websWrite(stream, "}\n"); 
    1803         websWrite(stream, "#menuSubList li a:hover {\n"); 
     1777        websWrite(stream, 
     1778                  "border-color:#%03x #%03x #%03x #%03x;\n}\n#menuSubList li a:hover {\n", 
     1779                  sdata[8], sdata[9], sdata[10], sdata[11]); 
    18041780        websWrite(stream, "background:#%03x;\n", sdata[12]); 
    18051781        websWrite(stream, "color:#%03x;\n", sdata[13]); 
    1806         websWrite(stream, "border-color:#%03x #%03x #%03x #%03x;\n", sdata[14], 
    1807                   sdata[15], sdata[16], sdata[17]); 
    1808         websWrite(stream, "}\n"); 
    1809         websWrite(stream, "fieldset legend {\n"); 
    1810         websWrite(stream, "color:#%03x;\n", sdata[18]); 
    1811         websWrite(stream, "}\n"); 
    1812         websWrite(stream, "#help a {\n"); 
    1813         websWrite(stream, "color:#%03x;\n", sdata[19]); 
    1814         websWrite(stream, "}\n"); 
    1815         websWrite(stream, "#help a:hover {\n"); 
    1816         websWrite(stream, "color:#%03x;\n", sdata[20]); 
    1817         websWrite(stream, "}\n"); 
    1818         websWrite(stream, ".meter .bar {\n"); 
    1819         websWrite(stream, "background-color: #%03x;\n", sdata[21]); 
    1820         websWrite(stream, "}\n"); 
    1821         websWrite(stream, ".meter .text {\n"); 
    1822         websWrite(stream, "color:#%03x;\n", sdata[22]); 
    1823         websWrite(stream, "}\n"); 
    1824         websWrite(stream, ".progressbar {\n"); 
     1782        websWrite(stream, 
     1783                  "border-color:#%03x #%03x #%03x #%03x;\n}\nfieldset legend {\n", 
     1784                  sdata[14], sdata[15], sdata[16], sdata[17]); 
     1785        websWrite(stream, "color:#%03x;\n}\n#help a {\n", sdata[18]); 
     1786        websWrite(stream, "color:#%03x;\n}\n#help a:hover {\n", sdata[19]); 
     1787        websWrite(stream, "color:#%03x;\n}\n.meter .bar {\n", sdata[20]); 
     1788        websWrite(stream, "background-color: #%03x;\n}\n.meter .text {\n", 
     1789                  sdata[21]); 
     1790        websWrite(stream, "color:#%03x;\n}\n.progressbar {\n", sdata[22]); 
    18251791        websWrite(stream, "background-color: #%03x;\n", sdata[23]); 
    1826         websWrite(stream, "border-color: #%03x;\n", sdata[24]); 
    1827         websWrite(stream, "font-size:.09em;\n"); 
    1828         websWrite(stream, "border-width:.09em;\n"); 
    1829         websWrite(stream, "}\n"); 
    1830         websWrite(stream, ".progressbarblock {\n"); 
    1831         websWrite(stream, "background-color: #%03x;\n", sdata[25]); 
    1832         websWrite(stream, "font-size:.09em;\n"); 
    1833         websWrite(stream, "}\n"); 
    1834         websWrite(stream, "input.button {\n"); 
     1792        websWrite(stream, 
     1793                  "border-color: #%03x;\nfont-size:.09em;\nborder-width:.09em;\n}\n.progressbarblock {\n", 
     1794                  sdata[24]); 
     1795        websWrite(stream, 
     1796                  "background-color: #%03x;\nfont-size:.09em;\n}\ninput.button {\n", 
     1797                  sdata[25]); 
    18351798        websWrite(stream, "background: #%03x;\n", sdata[26]); 
    1836         websWrite(stream, "color: #%03x;\n", sdata[27]); 
    1837         websWrite(stream, "}\n"); 
    1838         websWrite(stream, "input.button:hover {\n"); 
     1799        websWrite(stream, "color: #%03x;\n}\ninput.button:hover {\n", 
     1800                  sdata[27]); 
    18391801        websWrite(stream, "background: #%03x;\n", sdata[28]); 
    1840         websWrite(stream, "color: #%03x;\n", sdata[29]); 
    1841         websWrite(stream, "}\n"); 
     1802        websWrite(stream, "color: #%03x;\n}\n", sdata[29]); 
    18421803 
    18431804} 
     
    18571818} 
    18581819#endif 
    1859  
    18601820#ifdef HAVE_REGISTER 
    18611821static void do_trial_logo(struct mime_handler *handler, char *url, 
     
    20632023        int wd; 
    20642024        int i = 0; 
    2065         char months[12][12] = 
    2066             { "share.jan", "share.feb", "share.mar", "share.apr", "share.may", 
     2025        char months[12][12] = { 
     2026                "share.jan", "share.feb", "share.mar", "share.apr", "share.may", 
    20672027                "share.jun", 
    2068                 "share.jul", "share.aug", "share.sep", "share.oct", "share.nov", 
    2069                 "share.dec" 
     2028                "share.jul", "share.aug", "share.sep", "share.oct", 
     2029                "share.nov", "share.dec" 
    20702030        }; 
    2071         unsigned long rcvd[31] = 
    2072             { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    2073                 0, 
    2074                 0, 
    2075                 0, 0, 0, 0, 0, 0, 0 
     2031        unsigned long rcvd[31] = { 
     2032                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
     2033                0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
    20762034        }; 
    2077         unsigned long sent[31] = 
    2078             { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    2079                 0, 
    2080                 0, 
    2081                 0, 0, 0, 0, 0, 0, 0 
     2035        unsigned long sent[31] = { 
     2036                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
     2037                0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
    20822038        }; 
    20832039        unsigned long max = 5, smax = 5, f = 1; 
     
    21372093 
    21382094        websWrite(stream, 
    2139                   "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"); 
    2140         websWrite(stream, "<html>\n"); 
    2141         websWrite(stream, "<head>\n"); 
    2142         websWrite(stream, 
     2095                  "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" 
     2096                  "<html>\n" 
     2097                  "<head>\n" 
    21432098                  "<meta http-equiv=\"Content-Type\" content=\"application/xhtml+xml; charset=%s\" />\n", 
    21442099                  live_translate("lang_charset.set")); 
    2145         websWrite(stream, "<title>dd-wrt traffic graph</title>\n"); 
    2146  
    2147         websWrite(stream, "<script type=\"text/javascript\">\n"); 
    2148         websWrite(stream, "//<![CDATA[\n"); 
    2149         websWrite(stream, "function Show(label) {\n"); 
    2150         websWrite(stream, 
    2151                   "document.getElementById(\"label\").innerHTML = label;\n"); 
    2152         websWrite(stream, "}\n"); 
    2153         websWrite(stream, "//]]>\n"); 
    2154         websWrite(stream, "</script>\n"); 
    2155  
    2156         websWrite(stream, "<style type=\"text/css\">\n\n"); 
    2157         websWrite(stream, 
     2100 
     2101        websWrite(stream, "<title>dd-wrt traffic graph</title>\n" 
     2102                  "<script type=\"text/javascript\">\n" 
     2103                  "//<![CDATA[\n" 
     2104                  "function Show(label) {\n" 
     2105                  "document.getElementById(\"label\").innerHTML = label;\n" 
     2106                  "}\n" 
     2107                  "//]]>\n" 
     2108                  "</script>\n" 
     2109                  "<style type=\"text/css\">\n\n" 
    21582110                  "#t-graph {position: relative; width: %upx; height: 300px;\n", 
    21592111                  days * COL_WIDTH); 
    2160         websWrite(stream, "  margin: 1.1em 0 3.5em; padding: 0;\n"); 
    2161         websWrite(stream, "  border: 1px solid gray; list-style: none;\n"); 
    2162         websWrite(stream, "  font: 9px Tahoma, Arial, sans-serif;}\n"); 
    2163         websWrite(stream, 
    2164                   "#t-graph ul {margin: 0; padding: 0; list-style: none;}\n"); 
    2165         websWrite(stream, 
     2112        websWrite(stream, "  margin: 1.1em 0 3.5em; padding: 0;\n" 
     2113                  "  border: 1px solid gray; list-style: none;\n" 
     2114                  "  font: 9px Tahoma, Arial, sans-serif;}\n" 
     2115                  "#t-graph ul {margin: 0; padding: 0; list-style: none;}\n" 
    21662116                  "#t-graph li {position: absolute; bottom: 0; width: %dpx; z-index: 2;\n", 
    21672117                  COL_WIDTH); 
    2168         websWrite(stream, "  margin: 0; padding: 0;\n"); 
    2169         websWrite(stream, "  text-align: center; list-style: none;}\n"); 
    2170         websWrite(stream, 
    2171                   "#t-graph li.day {height: 298px; padding-top: 2px; border-right: 1px dotted #C4C4C4; color: #AAA;}\n"); 
    2172         websWrite(stream, 
    2173                   "#t-graph li.day_sun {height: 298px; padding-top: 2px; border-right: 1px dotted #C4C4C4; color: #E00;}\n"); 
    2174         websWrite(stream, 
    2175                   "#t-graph li.bar {width: 4px; border: 1px solid; border-bottom: none; color: #000;}\n"); 
    2176         websWrite(stream, "#t-graph li.bar p {margin: 5px 0 0; padding: 0;}\n"); 
    2177         websWrite(stream, "#t-graph li.rcvd {left: 3px; background: #228B22;}\n");      // set  
    2178         // rcvd  
    2179         // bar  
    2180         // colour  
    2181         // here  
    2182         // (green) 
    2183         websWrite(stream, "#t-graph li.sent {left: 8px; background: #CD0000;}\n");      // set  
    2184         // sent  
    2185         // bar  
    2186         // colour  
    2187         // here  
    2188         // (red) 
     2118        websWrite(stream, "  margin: 0; padding: 0;\n" 
     2119                  "  text-align: center; list-style: none;}\n" 
     2120                  "#t-graph li.day {height: 298px; padding-top: 2px; border-right: 1px dotted #C4C4C4; color: #AAA;}\n" 
     2121                  "#t-graph li.day_sun {height: 298px; padding-top: 2px; border-right: 1px dotted #C4C4C4; color: #E00;}\n" 
     2122                  "#t-graph li.bar {width: 4px; border: 1px solid; border-bottom: none; color: #000;}\n" 
     2123                  "#t-graph li.bar p {margin: 5px 0 0; padding: 0;}\n" 
     2124                  "#t-graph li.rcvd {left: 3px; background: #228B22;}\n" 
     2125                  "#t-graph li.sent {left: 8px; background: #CD0000;}\n"); 
    21892126 
    21902127        for (i = 0; i < days - 1; i++) { 
     
    22022139                  days * COL_WIDTH); 
    22032140        websWrite(stream, 
    2204                   "#t-graph #ticks .tick p {position: absolute; left: 100%%; top: -0.67em; margin: 0 0 0 0.5em;}\n"); 
    2205         websWrite(stream, 
    2206                   "#t-graph #label {width: 500px; bottom: -20px;  z-index: 1; font: 12px Tahoma, Arial, sans-serif; font-weight: bold;}\n"); 
    2207         websWrite(stream, "</style>\n"); 
    2208         websWrite(stream, "</head>\n\n"); 
    2209         websWrite(stream, "<body>\n"); 
    2210         websWrite(stream, "<ul id=\"t-graph\">\n"); 
     2141                  "#t-graph #ticks .tick p {position: absolute; left: 100%%; top: -0.67em; margin: 0 0 0 0.5em;}\n" 
     2142                  "#t-graph #label {width: 500px; bottom: -20px;  z-index: 1; font: 12px Tahoma, Arial, sans-serif; font-weight: bold;}\n" 
     2143                  "</style>\n" 
     2144                  "</head>\n\n" "<body>\n" "<ul id=\"t-graph\">\n"); 
    22112145 
    22122146        for (i = 0; i < days; i++) { 
     
    22452179        websWrite(stream, "%s %d (%s: %lu MB / %s: %lu MB)\n", monthname, year, 
    22462180                  incom, totin, outcom, totout); 
    2247         websWrite(stream, "</li>\n"); 
    2248  
    2249         websWrite(stream, "</ul>\n\n"); 
    2250         websWrite(stream, "</body>\n"); 
    2251         websWrite(stream, "</html>\n"); 
     2181        websWrite(stream, "</li>\n" "</ul>\n\n" "</body>\n" "</html>\n"); 
    22522182 
    22532183} 
     
    22612191                       "traffdata.bak"); 
    22622192        unlink("/tmp/traffdata.bak"); 
    2263 } 
    2264  
    2265 static void do_apply_cgi(struct mime_handler *handler, char *url, 
    2266                          webs_t stream, char *q) 
     2193} static void do_apply_cgi(struct mime_handler *handler, char *url, 
     2194                           webs_t stream, char *q) 
    22672195{ 
    22682196        char *path, *query; 
     
    23002228} 
    23012229#endif 
    2302  
    23032230extern int issuperchannel(void); 
    23042231 
Note: See TracChangeset for help on using the changeset viewer.