<%
if _SESSION["logined"] ~= nil then

	local admin_nowdir = "/"
	if _SESSION["admin_basefolder"] ~= nil and _SESSION["admin_basefolder"] ~= "" then
		admin_nowdir = _SESSION["admin_basefolder"]
	end

	if _SESSION["admin_nowdir"] ~= nil and _SESSION["admin_nowdir"] ~= "" then
		admin_nowdir = _SESSION["admin_nowdir"]
	end

	local changedir = _POST["dir"] or ""
	local CanChangedir = true
	if _SESSION["admin_basefolder"] ~= nil and _SESSION["admin_basefolder"] ~= "" then
		if c_StringLength(changedir) < c_StringLength(_SESSION["admin_basefolder"]) then
			CanChangedir = false
		end
	end

	if changedir ~= "" and c_IsDir(changedir) == true and CanChangedir == true and c_GetDir(changedir) ~= nil then
		if _SESSION["admin_readonly"] ~= nil and _SESSION["admin_readonly"] == 1 then
		else
			local old_nowdir = admin_nowdir
			admin_nowdir = changedir
			if _SESSION["admin_domainadmin"] ~= nil and _SESSION["admin_domainadmin"] == 1 then
				if c_StringFind(changedir.gsub(changedir,"//", "/").."/", c_GetAppPath() ) > -1 then
					admin_nowdir = old_nowdir
				end
			end
			local nowpath = string.gsub(admin_nowdir,"%[",":{{")
			nowpath = string.gsub(nowpath,"%]","}}:")
			rawset(_SESSION,"admin_nowdir",nowpath)
			SessionModule.save(_SESSION_ID)
		end
	end

	setContentType("text/xml; charset=UTF-8")
	local strResult = "<?xml version='1.0' encoding='UTF-8'?>\r\n"
	strResult = strResult.."<alldata><nowpath><![CDATA["
	strResult = strResult..admin_nowdir
	strResult = strResult.."]]></nowpath>\r\n"
	strResult = strResult.."<dirdata>\r\n"

	if admin_nowdir == "/" then
		for _,root in pairs(c_GetRootDir()) do
			if root ~= nil then
				strResult = strResult.."<rowdata><isdir>"..tostring(root["isdir"]).."</isdir><dir><![CDATA["..root["dir"].."]]></dir></rowdata>"
			end
		end
	else
		if _SESSION["admin_readonly"] ~= nil and _SESSION["admin_readonly"] == 1 then
		else
			for isdir,child in c_GetFileDir(admin_nowdir) do
				if child ~= nil and child ~= "." and child ~= ".."  then
					strResult = strResult.."<rowdata><isdir>"..tostring(isdir).."</isdir><dir><![CDATA[/"..child.."]]></dir></rowdata>"
				end
			end
		end
	end

	strResult = strResult.."</dirdata></alldata>\r\n"
	print(strResult)

end
%>