Changeset 1219

Show
Ignore:
Timestamp:
03/10/10 12:01:17 (2 years ago)
Author:
Hugo
Message:

idnsAdmin: fixed code style, funcMetaParam rewritten

Location:
trunk/unxsBind/interfaces/admin
Files:
3 added
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/unxsBind/interfaces/admin/resource.c

    r1214 r1219  
    576576void SearchResource(char *cLabel) 
    577577{ 
    578         sprintf(gcQuery,"SELECT tResource.uResource,tZone.cZone,tZone.uView,tResource.cName FROM tResource,tZone WHERE tResource.cName LIKE '%s%%' AND tResource.uZone=tZone.uZone AND tZone.uView=%s AND tZone.cZone='%s' ORDER BY tResource.cName",cLabel,cuView,gcZone); 
     578        sprintf(gcQuery,"SELECT tResource.uResource,tZone.cZone,tZone.uView,tResource.cName FROM " 
     579                        "tResource,tZone WHERE tResource.cName LIKE '%s%%' AND tResource.uZone=tZone.uZone " 
     580                        "AND tZone.uView=%s AND tZone.cZone='%s' ORDER BY tResource.cName",cLabel,cuView,gcZone); 
    579581 
    580582        mysql_query(&gMysql,gcQuery); 
     
    657659                mysql_free_result(res); 
    658660                if(!strstr(gcZone,"in-addr.arpa"))//A RR and has rights via uOwner 
    659                 sprintf(gcQuery,"SELECT tRRType.cLabel,tZone.uNSSet,tZone.uZone,tRRType.cParam1Label,tRRType.cParam1Tip,tRRType.cParam2Label,tRRType.cParam2Tip,tRRType.cParam3Label,tRRType.cParam3Tip,tRRType.cParam4Label,tRRType.cNameLabel,tRRType.cNameTip FROM tRRType,tZone WHERE tRRType.uRRType=1 AND tZone.cZone='%s' AND tZone.uView=%s",gcZone,cuView); 
     661                        sprintf(gcQuery,"SELECT tRRType.cLabel,tZone.uNSSet,tZone.uZone,tRRType.cParam1Label," 
     662                                        "tRRType.cParam1Tip,tRRType.cParam2Label,tRRType.cParam2Tip," 
     663                                        "tRRType.cParam3Label,tRRType.cParam3Tip,tRRType.cParam4Label," 
     664                                        "tRRType.cNameLabel,tRRType.cNameTip FROM tRRType,tZone WHERE " 
     665                                        "tRRType.uRRType=1 AND tZone.cZone='%s' AND tZone.uView=%s",gcZone,cuView); 
    660666                else    //PTR RR and has rights via zone.c  
    661667                        //(low grade cross-site scrpting security issue for registered login) 
    662                 sprintf(gcQuery,"SELECT tRRType.cLabel,tZone.uNSSet,tZone.uZone,tRRType.cParam1Label,tRRType.cParam1Tip,tRRType.cParam2Label,tRRType.cParam2Tip,tRRType.cParam3Label,tRRType.cParam3Tip,tRRType.cParam4Label,tRRType.cParam4Tip,tRRType.cNameLabel,tRRType.cNameTip FROM tRRType,tZone WHERE tRRType.uRRType=7 AND tZone.cZone='%s' AND tZone.uView=%s",gcZone,cuView); 
     668                        sprintf(gcQuery,"SELECT tRRType.cLabel,tZone.uNSSet,tZone.uZone,tRRType.cParam1Label," 
     669                                        "tRRType.cParam1Tip,tRRType.cParam2Label,tRRType.cParam2Tip," 
     670                                        "tRRType.cParam3Label,tRRType.cParam3Tip,tRRType.cParam4Label," 
     671                                        "tRRType.cParam4Tip,tRRType.cNameLabel,tRRType.cNameTip FROM " 
     672                                        "tRRType,tZone WHERE tRRType.uRRType=7 AND tZone.cZone='%s' " 
     673                                        "AND tZone.uView=%s",gcZone,cuView); 
    663674                mysql_query(&gMysql,gcQuery); 
    664675                if(mysql_errno(&gMysql)) 
     
    724735        } 
    725736         
    726         sprintf(gcQuery,"UPDATE tResource SET cName='%s',uTTL=%u,uRRType=%u,cParam1='%s',cParam2='%s',cParam3='%s',cParam4='%s',cComment='%s',uModBy=%u,uModDate=UNIX_TIMESTAMP(NOW()) WHERE uResource=%u", 
     737        sprintf(gcQuery,"UPDATE tResource SET cName='%s',uTTL=%u,uRRType=%u,cParam1='%s'," 
     738                        "cParam2='%s',cParam3='%s',cParam4='%s',cComment='%s',uModBy=%u," 
     739                        "uModDate=UNIX_TIMESTAMP(NOW()) WHERE uResource=%u", 
    727740                        cName, 
    728741                        uTTL, 
     
    14351448 
    14361449        } 
     1450        else if(!strcmp(cRRType,"AAAA")) 
     1451        { 
     1452        } 
     1453        else if(!strcmp(cRRType,"NAPTR")) 
     1454        { 
     1455        } 
    14371456        else if(1) 
    14381457        { 
     
    15411560{ 
    15421561        //This function will display the extra parameter inputs based on RRType 
    1543  
    1544         if(!strcmp(cRRType,"SRV")) 
    1545         { 
    1546 fprintf(fp, 
    1547                 "<tr><td><a class=inputLink href=\"#\" onClick=\"javascript:window.open('?gcPage=Glossary&cLabel=%s','Glossary','height=600,width=500,status=yes,toolbar=no,menubar=no,location=no,scrollbars=1')\"><strong>%s</strong></a>\n</td>\ 
    1548                 <td><input title='%s' type=text name=cParam2 value='%s' size=40 maxlength=255 class=%s></td>\ 
    1549                 </tr>\n\ 
    1550                 <tr><td><a class=inputLink href=\"#\" onClick=\"javascript:window.open('?gcPage=Glossary&cLabel=%s','Glossary','height=600,width=500,status=yes,toolbar=no,menubar=no,location=no,scrollbars=1')\"><strong>%s</strong></a>\n</td>\ 
    1551                 <td><input title='%s' type=text name=cParam3 value='%s' size=40 maxlength=255 class=%s></td>\ 
    1552                 </tr>\n\ 
    1553                 <tr><td><a class=inputLink href=\"#\" onClick=\"javascript:window.open('?gcPage=Glossary&cLabel=%s','Glossary','height=600,width=500,status=yes,toolbar=no,menubar=no,location=no,scrollbars=1')\"><strong>%s</strong></a>\n</td>\ 
    1554                 <td><input title='%s' type=text name=cParam4 value='%s' size=40 maxlength=255 class=%s></td>\ 
    1555                 </tr>\n", 
    1556                         cParam2Label 
    1557                         ,cParam2Label 
    1558                         ,cParam2Tip 
    1559                         ,cParam2 
    1560                         ,cParam2Style 
    1561                         ,cParam3Label 
    1562                         ,cParam3Label 
    1563                         ,cParam3Tip 
    1564                         ,cParam3 
    1565                         ,cParam3Style 
    1566                         ,cParam4Label 
    1567                         ,cParam4Label 
    1568                         ,cParam4Tip 
    1569                         ,cParam4 
    1570                         ,cParam4Style 
    1571                         ); 
    1572         } 
    1573         else if(strcmp(cRRType,"SRV") && strcmp(cParam2Label,"Not Used")) 
    1574         { 
    1575 fprintf(fp,"<tr><td><a class=inputLink href=\"#\" onClick=\"javascript:window.open('?gcPage=Glossary&cLabel=%s','Glossary','height=600,width=500,status=yes,toolbar=no,menubar=no,location=no,scrollbars=1')\"><strong>%s</strong></a>\n</td><td><input title='%s' type=text name=cParam2 value='%s' size=40 maxlength=255 class=%s></td></tr>\n", 
    1576                 cParam2Label 
    1577                 ,cParam2Label 
    1578                 ,cParam2Tip 
    1579                 ,cParam2 
    1580                 ,cParam2Style 
    1581                 ); 
    1582         } 
     1562        MYSQL_RES *res; 
     1563        MYSQL_ROW field; 
     1564 
     1565        struct t_template template; 
     1566        unsigned uParam2=0; 
     1567        unsigned uParam3=0; 
     1568        unsigned uParam4=0; 
     1569 
     1570        sprintf(gcQuery,"SELECT uParam2,uParam3,uParam4 FROM tRRType WHERE cLabel='%s'",TextAreaSave(cRRType)); 
     1571        mysql_query(&gMysql,gcQuery); 
     1572        if(mysql_errno(&gMysql)) 
     1573                htmlPlainTextError(mysql_error(&gMysql)); 
     1574        res=mysql_store_result(&gMysql); 
     1575        if((field=mysql_fetch_row(res))) 
     1576        { 
     1577                sscanf(field[0],"%u",&uParam2); 
     1578                sscanf(field[1],"%u",&uParam3); 
     1579                sscanf(field[2],"%u",&uParam4); 
     1580        } 
     1581        mysql_free_result(res); 
     1582 
     1583        template.cpName[0]="cParam2Label"; 
     1584        template.cpValue[0]=cParam2Label; 
     1585 
     1586        template.cpName[1]="cParam2Tip"; 
     1587        template.cpValue[1]=cParam2Tip; 
     1588 
     1589        template.cpName[2]="cParam2"; 
     1590        template.cpValue[2]=cParam2; 
     1591         
     1592        template.cpName[3]="cParam2Style"; 
     1593        template.cpValue[3]=cParam2Style; 
     1594 
     1595        template.cpName[4]="cParam3Label"; 
     1596        template.cpValue[4]=cParam3Label; 
     1597 
     1598        template.cpName[5]="cParam3Tip"; 
     1599        template.cpValue[5]=cParam3Tip; 
     1600 
     1601        template.cpName[6]="cParam3"; 
     1602        template.cpValue[6]=cParam3; 
     1603         
     1604        template.cpName[7]="cParam3Style"; 
     1605        template.cpValue[7]=cParam3Style; 
     1606         
     1607        template.cpName[8]="cParam4Label"; 
     1608        template.cpValue[8]=cParam4Label; 
     1609 
     1610        template.cpName[9]="cParam4Tip"; 
     1611        template.cpValue[9]=cParam4Tip; 
     1612 
     1613        template.cpName[10]="cParam4"; 
     1614        template.cpValue[10]=cParam4; 
     1615         
     1616        template.cpName[11]="cParam4Style"; 
     1617        template.cpValue[11]=cParam4Style; 
     1618         
     1619        template.cpName[12]="gcInputStatus"; 
     1620        template.cpValue[12]=gcInputStatus; 
     1621         
     1622        template.cpName[13]=""; 
     1623 
     1624        if(uParam2) 
     1625                fpTemplate(fp,"InputParam2",&template); 
     1626         
     1627        if(uParam3) 
     1628                fpTemplate(fp,"InputParam3",&template); 
     1629         
     1630        if(uParam4) 
     1631                fpTemplate(fp,"InputParam4",&template); 
    15831632 
    15841633}//void funcMetaParam(FILE *fp)