All pastes #185557 Raw Edit

Something

public text v1 · immutable
#185557 ·published 2006-09-29 02:08 UTC
rendered paste body
<!-- #include file="../includes/variables.asp"-->

<%
	'on error resume next
	
	dim fso, f, txtStream, reg, incPath
	
	set reg = new RegExp
	set fso = server.createObject("Scripting.FileSystemObject")
	
	if vartype(content_file) = 0 or isempty(content_file) then
		dim matches
		
		reg.pattern = "([a-z0-9_\-]+)"
		reg.ignoreCase = true
		
		if reg.test( request.serverVariables("SCRIPT_NAME") ) then
			set matches = reg.execute( request.serverVariables("SCRIPT_NAME") )
			content_file = matches(0).value
		else
			content_file = "index"
		end if
		
		set matches = nothing
	else
		content_file = "index"
	end if
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
		
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
	<title><%
		if not isempty(title) then
			response.write title
		else
			response.write "Photographers Gallery CMS"
		end if
	%></title>

	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
	<meta http-equiv="Content-Style-Type" content="text/css" />
	<meta name="robots" content="noindex,nofollow" />
	
	<%
		incPath = server.mapPath("inc\css") &"\"
		if fso.fileExists(incPath & content_file &".asp") then
			response.write "<link rel=""stylesheet"" href=""inc/css/"& content_file &".asp"" />"& vbcrlf
		elseif fso.fileExists(incPath & content_file &".css") then
			response.write "<link rel=""stylesheet"" href=""inc/css/"& content_file &".css"" />"& vbcrlf
		else
			response.write "<link rel=""stylesheet"" href=""inc/css/default.css"" />"& vbcrlf
		end if
	%>
	
	<script type="text/javascript" src="inc/js/default.js"></script>
	<%
		incPath = server.mapPath("inc\js") &"\"
		if fso.fileExists(incPath & content_file &".asp") then
			set txtStream = fso.openTextFile(incPath &"\"& content_file &".asp")
			
			response.write txtStream.readAll()
			txtStream.close
			
			set txtStream = nothing
		elseif fso.fileExists(incPath & content_file &".js") then
			response.write "<script type=""text/javascript"" src=""inc/js/"& content_file &".js""></script>"
		end if	
	%>
</head>

<body>