home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 45 / PC Gamer IT CD 45 2-2.iso / addons / photodraw / NT4SP4 / SP4I386.EXE / iiput.asp < prev    next >
Encoding:
Text File  |  1998-10-15  |  5.5 KB  |  250 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.     Response.write key & "<BR>"
  55.     if (key <>"PAGE" ) and (key <> "STATE") and  (key <> "CLEARPATHS")  then
  56.         if inStr(specprops,key) <> 0 then
  57.             err=0
  58.             Set thisobj=sobj        
  59.             value=Request.QueryString(key)
  60.             if UCase(value)="TRUE" then
  61.                 bval=True
  62.             else
  63.                 bval=False
  64.             end if 
  65.  
  66.             Select Case UCase(key)
  67.             Case "GRANTBYDEFAULT" 
  68.                 if thisobj.GrantbyDefault <> bval then
  69.                     changed = true    
  70.                     thisobj.GrantbyDefault=bval                
  71.                 end if
  72.                 currentobj.IPSecurity=thisobj
  73.  
  74.             Case "FRONTPAGEWEB"
  75.                 if thisobj.FrontPageWeb <> bval then            
  76.                     changed = true                    
  77.                     thisobj.FrontPageWeb=bval
  78.                 end if
  79.                 
  80.             Case "MSDOSDIROUTPUT"
  81.                 if thisobj.MSDOSDirOutput <> bval then            
  82.                     changed = true                    
  83.                     thisobj.MSDOSDirOutput=bval
  84.  
  85.                 end if        
  86.                 
  87.             Case "HTTPEXPIRES"
  88.                 if value = "d,-1" then            
  89.                     changed = true                    
  90.                     thisobj.HttpExpires = ""
  91.                 else
  92.                     if thisobj.HttpExpires <> value then
  93.                         changed = true    
  94.                         thisobj.Put key, (value)
  95.                     end if
  96.                 end if
  97.  
  98.             Case "SERVERBINDINGS"            
  99.                 Dim bindings
  100.                 Response.write "ServerBindings:"
  101.                 bindings = split(value,",")
  102.                 Response.write "Bound:" & UBound(bindings)
  103.                 if chkUpdated(thisobj.ServerBindings,bindings) then
  104.                     thisobj.Put key, (bindings)
  105.                 end if
  106.                 
  107.             End Select
  108.             
  109.             thisobj.SetInfo
  110.     
  111.         else
  112.             Set thisobj=currentobj
  113.  
  114.             newval=Request.QueryString(key)        
  115.             curval=thisobj.Get(key)
  116.                     
  117.                 if not isArray(curval) then
  118.                     Select Case typename(curval)
  119.                         Case "Boolean" 
  120.                             if UCase(newval)="TRUE" then
  121.                                 value=True
  122.                             else
  123.                                 value=False
  124.                             end if 
  125.                         Case "Long"
  126.                             value = cLng(newval)
  127.                         Case Else
  128.                             value = newval
  129.                     End Select
  130.                     
  131.                     if curval <> value then    
  132.                         changed = true                                                
  133.                         thisobj.Put key, (value)
  134.                     end if    
  135.                 else
  136.                     ReDim proparray(0)
  137.                     proparray(0) = newval
  138.                     if chkUpdated(curval,proparray) then
  139.                         thisobj.Put key, (proparray)
  140.                     end if
  141.                 end if            
  142.  
  143.                 thisobj.SetInfo
  144.         end if
  145.     end if
  146.  
  147.     if changed then
  148.  
  149.         if clearPaths then
  150.             aSetChildPaths = thisobj.GetDataPaths(key,IIS_DATA_INHERIT) 
  151.             if err = 0 then
  152.                 For Each childpath in aSetChildPaths
  153.                     childPath = cleanPath(childPath)
  154.                 
  155.                     Set child = GetObject(childpath)
  156.                     if child.ADSPath <> thisobj.ADSPath then
  157.                         if (instr(LCase(child.ADSPath), "IIS://localhost/w3svc/info") > 0) OR (instr(LCase(child.ADSPath), "IIS://localhost/msftpsvc/info") > 0) then
  158.                         else
  159.                             child.PutEx ADS_PROPERTY_CLEAR, key, ""
  160.                             child.SetInfo
  161.                         end if
  162.                     end if
  163.                 Next    
  164.             end if
  165.             err = 0
  166.         end if
  167.     end if
  168. Next
  169.  
  170. currentobj.SetInfo
  171.  
  172.  
  173. Function cleanPath(pathstr)
  174.     if Right(pathstr,1) = "/" then
  175.         pathstr = Mid(pathstr, 1,len(pathstr)-1)
  176.     end if
  177.     cleanPath = pathstr
  178. End Function
  179.  
  180. Function chkUpdated(oldarray,proparray)
  181.  
  182.     dim proparraybound,arrayWasUpdated, i
  183.     
  184.     if IsArray(oldarray) then
  185.         proparraybound=UBound(proparray)
  186.         if UBound(oldarray) <> proparraybound then
  187.             arrayWasUpdated=true
  188.         else
  189.             for i=0 to proparraybound
  190.                 if oldarray(i) <> proparray(i) then                    
  191.                     arrayWasUpdated=true
  192.                 end if
  193.             Next
  194.         end if
  195.     else        
  196.         if proparraybound > 0 then
  197.             arrayWasUpdated=true
  198.         else
  199.             arrayWasUpdated=(proparray(0) <> oldarray)            
  200.         end if
  201.     end if
  202.     
  203.     'set our global changed var
  204.     changed = arrayWasUpdated
  205.     
  206.     chkUpdated = arrayWasUpdated
  207.     
  208. End Function
  209.  
  210. %>
  211.  
  212. </HEAD>
  213.  
  214. <BODY BGCOLOR="#000000" TEXT="#FFCC00" TOPMARGIN=0 LEFTMARGIN=0>
  215. <SCRIPT LANGUAGE="JavaScript">
  216.  
  217.     <% if Request.QueryString("PAGE") <> "popup" then %>
  218.     top.title.Global.updated=false;
  219.     if (top.body.frames.length > 0){    
  220.         <% if Request("ServerComment") <> "" then %>
  221.         top.title.nodeList[top.title.Global.selId].title="<%= Request("ServerComment") %>";
  222.         if (top.body.menu != null){
  223.             top.body.menu.location.href=top.body.menu.location.href;
  224.         }
  225.         <% end if %>
  226.         
  227.  
  228.         if (top.body.frames.length > 3){
  229.         <% if Session("IsIE") then %>
  230.             top.body.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  231.         
  232.         <% else %>
  233.             top.body.frames[3].location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  234.         <% end if %>            
  235.         }
  236.         else{
  237.             if (top.body.iisstatus != null){    
  238.                 top.body.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  239.             }
  240.         }
  241.     }    
  242.     <% end if %>
  243.     
  244. </SCRIPT>
  245.  
  246. </BODY>
  247. </HTML>
  248.  
  249.  
  250.