Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

334 lines
8.0 KiB

  1. <%@ LANGUAGE = VBScript %>
  2. <% Option Explicit %>
  3. <!-- #include file="directives.inc" -->
  4. <!--#include file="iiput.str"-->
  5. <%
  6. Const ADS_PROPERTY_CLEAR = 1
  7. Const IIS_DATA_INHERIT = 1
  8. Const IISAO_WEB_SERVICE_CLASS = "IIsWebService"
  9. %>
  10. <HTML>
  11. <HEAD>
  12. <%
  13. On Error Resume Next
  14. Dim path, lasterr, currentobj, key, sobj, specprops, newval,dirkeyType
  15. Dim changed, objname, thisobj, value, bval, curval,quote, childpath, aSetChildPaths
  16. Dim clearPaths, child, proparray
  17. dirkeyType = "IIsWebDirectory"
  18. quote = chr(34)
  19. lasterr=""
  20. path=Session("path")
  21. 'Response.write path
  22. if Session("clearPathsOneTime") <> "" then
  23. clearPaths = Session("clearPathsOneTime")
  24. else
  25. clearPaths = (Session("clearPaths") <> "")
  26. end if
  27. 'Response.write hex(err)
  28. 'Response.write clearPaths
  29. Set currentobj=GetObject(path)
  30. %>
  31. <!--#include file="iifixpth.inc"-->
  32. <%
  33. specprops = "SERVERBINDINGS,HTTPEXPIRES,GRANTBYDEFAULT,MSDOSDIROUTPUT," & _
  34. "HCDOSTATICCOMPRESSION,HCDODYNAMICCOMPRESSION,HCCOMPRESSIONDIRECTORY," & _
  35. "HCDODISKSPACELIMITING,HCMAXDISKSPACEUSAGE,APPISOLATED"
  36. 'Response.write "SpecObj - " & Session("SpecObj") & "<BR>"
  37. 'Response.write "SpecProps - " & Session("SpecProps") & "<BR>"
  38. 'Response.write "currentobj - " & currentobj.ADsPath & "<BR>"
  39. changed=false
  40. For Each key In Request.QueryString
  41. key = UCase(key)
  42. changed=false
  43. ' Response.write "key - " & key & "<BR>"
  44. if (key <>"PAGE" ) and (key <> "STATE") and (key <> "CLEARPATHS") then
  45. if inStr(specprops,key) <> 0 then
  46. ' Special properties
  47. err.Clear
  48. value=Request.QueryString(key)
  49. Select Case UCase(key)
  50. Case "GRANTBYDEFAULT"
  51. Set thisobj = currentobj.Get( "IPSecurity" )
  52. bval = CBool(value)
  53. if thisobj.GrantByDefault <> bval then
  54. thisobj.GrantByDefault = bval
  55. currentobj.IPSecurity=thisobj
  56. currentobj.SetInfo
  57. changed = True
  58. end if
  59. Case "HTTPEXPIRES"
  60. Set thisobj = currentobj
  61. if value = "d,-1" then
  62. changed = true
  63. thisobj.HttpExpires = ""
  64. else
  65. changed = writeStdProp(thisobj, key)
  66. end if
  67. thisobj.SetInfo
  68. Case "SERVERBINDINGS"
  69. Set thisobj = currentobj
  70. Dim bindings
  71. bindings = split(value,",")
  72. if chkUpdated(thisobj.ServerBindings,bindings) then
  73. thisobj.Put key, (bindings)
  74. changed = true
  75. end if
  76. thisobj.SetInfo
  77. Case "MSDOSDIROUTPUT"
  78. Set thisobj = GetObject( currentobj.Parent )
  79. changed = writeStdProp(thisobj, key)
  80. thisobj.SetInfo
  81. Case "HCDOSTATICCOMPRESSION", "HCDODYNAMICCOMPRESSION", _
  82. "HCCOMPRESSIONDIRECTORY", "HCDODISKSPACELIMITING", _
  83. "HCMAXDISKSPACEUSAGE"
  84. Set thisobj = GetObject( "IIS://localhost/w3svc/Filters/Compression/Parameters" )
  85. changed = writeStdProp(thisobj, key)
  86. thisobj.SetInfo
  87. Case "APPISOLATED"
  88. set thisobj = currentobj
  89. ' Response.write thisobj.ADsPath & "<BR>"
  90. ' Response.write thisobj.Name & "<BR>"
  91. ' Response.write thisobj.Class & "<BR>"
  92. ' Is this actually an application?
  93. ' Has the value of AppIsolated changed?
  94. newval = CInt(Request.QueryString(key))
  95. curval = thisobj.Get(key)
  96. ' Response.write "newval - " & newval & "&nbsp;"
  97. ' Response.write "curval - " & curval & "<BR>"
  98. if isApplication( thisobj ) And newval <> curval then
  99. if clearPaths then
  100. thisobj.AppDeleteRecursive
  101. ' Response.write "thisobj.AppDeleteRecursive" & "<BR>"
  102. ' Response.write "Err.Number = " & Hex(Err.Number) & "<BR>"
  103. end if
  104. thisobj.AppCreate2 newval
  105. ' Response.write "thisobj.AppCreate2 " & newval & "<BR>"
  106. ' Response.write "Err.Number = " & Hex(Err.Number) & "<BR>"
  107. elseif thisobj.Class = IISAO_WEB_SERVICE_CLASS then
  108. changed = writeStdProp(thisobj, key)
  109. end if
  110. ' Set as unchanged to prevent the path clear from actually modifying
  111. ' this property
  112. changed = False
  113. Case Else
  114. ' This is really an error, but we'll try anyway
  115. Set thisobj = currentobj
  116. changed = writeStdProp(thisobj, key)
  117. thisobj.SetInfo
  118. End Select
  119. else
  120. ' Standard properties
  121. Set thisobj=currentobj
  122. newval=Request.QueryString(key)
  123. curval=thisobj.Get(key)
  124. if not isArray(curval) then
  125. changed = writeStdProp(thisobj, key)
  126. else
  127. ReDim proparray(0)
  128. proparray(0) = newval
  129. if chkUpdated(curval,proparray) then
  130. thisobj.Put key, (proparray)
  131. changed = True
  132. end if
  133. end if
  134. thisobj.SetInfo
  135. end if
  136. end if
  137. err.clear
  138. if changed then
  139. if clearPaths then
  140. ' Response.write thisobj.ADSPath & "<BR>"
  141. ' Response.write "Name:" & thisobj.ADsPath & "<BR>"
  142. ' Response.write key & "<BR>"
  143. aSetChildPaths = thisobj.GetDataPaths(key,IIS_DATA_INHERIT)
  144. ' Response.write hex(err)
  145. if err = 0 then
  146. For Each childpath in aSetChildPaths
  147. ' Response.write childpath & "<BR>"
  148. childPath = cleanPath(childPath)
  149. Set child = GetObject(childpath)
  150. if child.ADSPath <> thisobj.ADSPath then
  151. if (instr(LCase(child.ADSPath), "IIS://localhost/w3svc/info") > 0) OR (instr(LCase(child.ADSPath), "IIS://localhost/msftpsvc/info") > 0) then
  152. else
  153. child.PutEx ADS_PROPERTY_CLEAR, key, ""
  154. child.SetInfo
  155. end if
  156. end if
  157. Next
  158. end if
  159. err = 0
  160. end if
  161. end if
  162. Next
  163. currentobj.SetInfo
  164. ' Same function defined in iicache2.asp, should share the
  165. ' same implementation.
  166. function isApplication( objWebNode )
  167. On Error Resume Next
  168. dim bReturn, strAppRoot, strADsPath
  169. bReturn = False
  170. strAppRoot = UCase(objWebNode.AppRoot)
  171. if strAppRoot <> "" then
  172. ' The AppRoot is inherited, if there is really an application
  173. ' defined at this node, the paths will point to the same node.
  174. strADsPath = UCase(objWebNode.ADsPath)
  175. strAppRoot = Mid(strAppRoot,Instr(strAppRoot,"W3SVC/")+1)
  176. strADsPath = Mid(strADsPath,Instr(strADsPath,"W3SVC/")+1)
  177. if strADsPath = strAppRoot then
  178. bReturn = True
  179. end if
  180. end if
  181. isApplication = bReturn
  182. end function
  183. Function writeStdProp(thisobj, key)
  184. dim curval, newval
  185. newval=Request.QueryString(key)
  186. curval=thisobj.Get(key)
  187. ' Response.write "newval - " & newval & "&nbsp;"
  188. ' Response.write "curval - " & curval & "<BR>"
  189. Select Case typename(curval)
  190. Case "Boolean"
  191. value = (UCase(newval) = "TRUE")
  192. Case "Long"
  193. value = cLng(newval)
  194. Case Else
  195. value = newval
  196. End Select
  197. if curval <> value then
  198. thisobj.Put key, (value)
  199. writeStdProp = True
  200. else
  201. writeStdProp = False
  202. end if
  203. End Function
  204. Function cleanPath(pathstr)
  205. if Right(pathstr,1) = "/" then
  206. pathstr = Mid(pathstr, 1,len(pathstr)-1)
  207. end if
  208. cleanPath = pathstr
  209. End Function
  210. Function chkUpdated(oldarray,proparray)
  211. dim proparraybound,arrayWasUpdated, i
  212. if IsArray(oldarray) then
  213. proparraybound=UBound(proparray)
  214. if UBound(oldarray) <> proparraybound then
  215. arrayWasUpdated=true
  216. else
  217. for i=0 to proparraybound
  218. if oldarray(i) <> proparray(i) then
  219. arrayWasUpdated=true
  220. end if
  221. Next
  222. end if
  223. else
  224. if proparraybound > 0 then
  225. arrayWasUpdated=true
  226. else
  227. arrayWasUpdated=(proparray(0) <> oldarray)
  228. end if
  229. end if
  230. 'set our global changed var
  231. changed = arrayWasUpdated
  232. chkUpdated = arrayWasUpdated
  233. End Function
  234. %>
  235. </HEAD>
  236. <BODY BGCOLOR="#000000" TEXT="#FFCC00" TOPMARGIN=0 LEFTMARGIN=0>
  237. <SCRIPT LANGUAGE="JavaScript">
  238. <% if Request.QueryString("PAGE") <> "popup" then %>
  239. top.title.Global.updated=false;
  240. if (top.body.frames.length > 0){
  241. <% if Request("ServerComment") <> "" then %>
  242. top.title.nodeList[top.title.Global.selId].title="<%= Request("ServerComment") %>";
  243. if (top.body.menu != null){
  244. top.body.menu.location.href=top.body.menu.location.href;
  245. }
  246. <% end if %>
  247. if (top.body.frames.length > 3){
  248. <% if Session("IsIE") then %>
  249. top.body.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  250. <% else %>
  251. top.body.frames[3].location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  252. <% end if %>
  253. }
  254. else{
  255. if (top.body.iisstatus != null){
  256. top.body.iisstatus.location.href="iistat.asp?thisState=" + escape("<%= L_CHANGESSAVED_TEXT %>");
  257. }
  258. }
  259. }
  260. <% end if %>
  261. </SCRIPT>
  262. </BODY>
  263. </HTML>