home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_03.cab / iiput.asp < prev    next >
Text File  |  1997-11-12  |  5KB  |  240 lines

  1. <%@ LANGUAGE=VBScript %>
  2. <% Option Explicit %>
  3. <% Response.Expires = 0 %>
  4.  
  5. <%
  6.  
  7. Const L_CHANGESSAVED_TEXT="Your changes have been saved."
  8. Const ADS_PROPERTY_CLEAR = 1
  9. Const IIS_DATA_INHERIT = 1
  10. %>
  11.  
  12. <HTML>
  13. <HEAD>
  14.  
  15.  
  16. <% 
  17. On Error Resume Next 
  18.  
  19. Dim path, lasterr, currentobj, key, sobj, specprops, newval,dirkeyType
  20. Dim changed, objname, thisobj, value, bval, curval,quote, childpath, aSetChildPaths
  21. Dim clearPaths, child, proparray
  22. dirkeyType = "IIsWebDirectory"
  23. quote = chr(34)
  24.  
  25. lasterr=""
  26. path=Session("path")
  27. Response.write path
  28.  
  29. if Session("clearPathsOneTime") <> "" then 
  30.     clearPaths = Session("clearPathsOneTime")
  31. else
  32.     clearPaths = (Session("clearPaths") <> "")
  33. end if
  34. Set currentobj=GetObject(path)
  35.  
  36. %>
  37. <!--#include file="iifixpth.inc"-->
  38. <%
  39.  
  40. if Session("SpecObj") <> "" then
  41.     if Session("SpecObj")="IPSecurity" then
  42.         Set sobj=currentobj.Get(Session("SpecObj"))
  43.     else
  44.         Set sobj=GetObject(Session("SpecObj"))
  45.     end if
  46.     specprops=UCase(Session("SpecProps"))
  47. end if
  48.  
  49. changed=false
  50.  
  51. For Each key In Request.QueryString
  52.     key = UCase(key)
  53.     changed=false
  54.     if (key <>"PAGE" ) and (key <> "STATE") and  (key <> "CLEARPATHS")  then
  55.         if inStr(specprops,key) <> 0 then
  56.             err=0
  57.             Set thisobj=sobj        
  58.             value=Request.QueryString(key)
  59.             if UCase(value)="TRUE" then
  60.                 bval=True
  61.             else
  62.                 bval=False
  63.             end if 
  64.             
  65.             Select Case UCase(key)
  66.             Case "GRANTBYDEFAULT" 
  67.                 if thisobj.GrantbyDefault <> bval then
  68.                     changed = true    
  69.                     thisobj.GrantbyDefault=bval                
  70.                 end if
  71.                 currentobj.IPSecurity=thisobj
  72.  
  73.             Case "FRONTPAGEWEB"
  74.                 if thisobj.FrontPageWeb <> bval then            
  75.                     changed = true                    
  76.                     thisobj.FrontPageWeb=bval
  77.                 end if
  78.                 
  79.             Case "MSDOSDIROUTPUT"
  80.                 if thisobj.MSDOSDirOutput <> bval then            
  81.                     changed = true                    
  82.                     thisobj.MSDOSDirOutput=bval
  83.  
  84.                 end if        
  85.                 
  86.             Case "HTTPEXPIRES"
  87.                 if value = "d,-1" then            
  88.                     changed = true                    
  89.                     thisobj.HttpExpires = ""
  90.                 else
  91.                     if thisobj.HttpExpires <> value then
  92.                         changed = true    
  93.                         thisobj.Put key, (value)
  94.                     end if
  95.                 end if    
  96.                 
  97.             End Select
  98.             
  99.             thisobj.SetInfo
  100.     
  101.         else
  102.             Set thisobj=currentobj
  103.  
  104.             newval=Request.QueryString(key)        
  105.             curval=thisobj.Get(key)
  106.                     
  107.                 if not isArray(curval) then
  108.                     Select Case typename(curval)
  109.                         Case "Boolean" 
  110.                             if UCase(newval)="TRUE" then
  111.                                 value=True
  112.                             else
  113.                                 value=False
  114.                             end if 
  115.                         Case "Long"
  116.                             value = cLng(newval)
  117.                         Case Else
  118.                             value = newval
  119.                     End Select
  120.                     
  121.                     if curval <> value then    
  122.                         changed = true                                                
  123.                         thisobj.Put key, (value)
  124.                     end if    
  125.                 else
  126.                     ReDim proparray(0)
  127.                     proparray(0) = newval
  128.                     if chkUpdated(curval,proparray) then
  129.                         thisobj.Put key, (proparray)
  130.                     end if
  131.                 end if            
  132.  
  133.                 thisobj.SetInfo
  134.         end if
  135.     end if
  136.  
  137.     if changed then
  138.  
  139.         if clearPaths then
  140.             aSetChildPaths = thisobj.GetDataPaths(key,IIS_DATA_INHERIT) 
  141.             if err = 0 then
  142.                 For Each childpath in aSetChildPaths
  143.                     childPath = cleanPath(childPath)
  144.                 
  145.                     Set child = GetObject(childpath)
  146.                     if child.ADSPath <> thisobj.ADSPath then
  147.                         if (instr(LCase(child.ADSPath), "IIS://localhost/w3svc/info") > 0) OR (instr(LCase(child.ADSPath), "IIS://localhost/msftpsvc/info") > 0) then
  148.                         else
  149.                             child.PutEx ADS_PROPERTY_CLEAR, key, ""
  150.                             child.SetInfo
  151.                         end if
  152.                     end if
  153.                 Next    
  154.             end if
  155.             err = 0
  156.         end if
  157.     end if
  158. Next
  159.  
  160. currentobj.SetInfo
  161.  
  162.  
  163. Function cleanPath(pathstr)
  164.     if Right(pathstr,1) = "/" then
  165.         pathstr = Mid(pathstr, 1,len(pathstr)-1)
  166.     end if
  167.     cleanPath = pathstr
  168. End Function
  169.  
  170. Function chkUpdated(oldarray,proparray)
  171.  
  172.     dim proparraybound,arrayWasUpdated, i
  173.     
  174.     if IsArray(oldarray) then
  175.         proparraybound=UBound(proparray)
  176.         if UBound(oldarray) <> proparraybound then
  177.             arrayWasUpdated=true
  178.         else
  179.             for i=0 to proparraybound
  180.                 if oldarray(i) <> proparray(i) then                    
  181.                     arrayWasUpdated=true
  182.                 end if
  183.             Next
  184.         end if
  185.     else        
  186.         if proparraybound > 0 then
  187.             arrayWasUpdated=true
  188.         else
  189.             arrayWasUpdated=(proparray(0) <> oldarray)            
  190.         end if
  191.     end if
  192.     
  193.     'set our global changed var
  194.     changed = arrayWasUpdated
  195.     
  196.     chkUpdated = arrayWasUpdated
  197.     
  198. End Function
  199.  
  200. %>
  201.  
  202. </HEAD>
  203.  
  204. <BODY BGCOLOR="#000000" TEXT="#FFCC00" TOPMARGIN=0 LEFTMARGIN=0>
  205. <SCRIPT LANGUAGE="JavaScript">
  206.  
  207.     <% if Request.QueryString("PAGE") <> "popup" then %>
  208.     top.title.Global.updated=false;
  209.     if (top.body.frames.length > 0){    
  210.         <% if Request("ServerComment") <> "" then %>
  211.         top.title.nodeList[top.title.Global.selId].title="<%= Request("ServerComment") %>";
  212.         if (top.body.menu != null){
  213.             top.body.menu.location.href=top.body.menu.location.href;
  214.         }
  215.         <% end if %>
  216.         
  217.  
  218.         if (top.body.frames.length > 3){
  219.         <% if Session("IsIE") then %>
  220.             top.body.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  221.         
  222.         <% else %>
  223.             top.body.frames[3].location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  224.         <% end if %>            
  225.         }
  226.         else{
  227.             if (top.body.iisstatus != null){    
  228.                 top.body.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  229.             }
  230.         }
  231.     }    
  232.     <% end if %>
  233.     
  234. </SCRIPT>
  235.  
  236. </BODY>
  237. </HTML>
  238.  
  239.  
  240.