<%@ Language=VBScript %>
<%Option Explicit%>
<%Response.Buffer = true%>
<%
dim conn
dim rs
dim yaz
dim oku
dim dept
dim folderpath
dim wexRoot
set conn=server.CreateObject("ADODB.Connection")
conn.Open "tekintranet"
set rs=server.CreateObject("ADODB.Recordset")
rs.Open "users", conn
' Þifreyi kaldýrmak için týrnak aralarýný boþ býrakýn = ""
Const wexPassword = "admin"
' Ana dizin sanal bir dizin olabilir: "c:\test", "/test"
' Eðer "c:\test" gibi fiziksel bir dizin kullanýrsanýz dosya yukleme, silme hakkýna sahip olamayacaksýnýz.
Select Case session("dept")
Case 10 folderpath="c:\inetpub\wwwroot\portal"
Case 41 folderpath="c:\inetpub\wwwroot\portal\diskhat"
Case 42 folderpath="c:\inetpub\wwwroot\portal\sjanthat"
Case 43 folderpath="c:\inetpub\wwwroot\portal\pjanthat"
Case 44 folderpath="c:\inetpub\wwwroot\portal\ojanthat"
Case 45 folderpath="c:\inetpub\wwwroot\portal\boyahat"
Case 46 folderpath="c:\inetpub\wwwroot\portal\lchat"
Case 50 folderpath="c:\inetpub\wwwroot\portal\muhhiz"
Case 51 folderpath="c:\inetpub\wwwroot\portal\tekburo"
Case 52 folderpath="c:\inetpub\wwwroot\portal\kalip"
Case 60 folderpath="c:\inetpub\wwwroot\portal\kalite"
Case 70 folderpath="c:\inetpub\wwwroot\portal\bakim"
Case 80 folderpath="c:\inetpub\wwwroot\portal\plansat"
Case 85 folderpath="c:\inetpub\wwwroot\portal\bilgisistem"
Case 90 folderpath="c:\inetpub\wwwroot\portal\muhasebe"
Case Else
End Select
if session("admin")=true then
folderpath="c:\inetpub\wwwroot"
end if
session("folderpath")=folderpath
wexRoot=session("folderpath")
' Düzenlenen karakter seti
Const wexCharSet = "ISO-8859-9"
' Gizli dosyalarý göstersin mi?
Const showHiddenItems = true
' Klasör boyutlarýný hesaplama, büyük klasörler için uzun sürebilir
Const calculateTotalSize = true
' Dosya boyutlarýný hesaplama
Const calculateFolderSize = true
' Aþaðýdaki dosyalar yanýndki T ikonuna týklayarak düzenlenebilir.
Const editableExtensions = "*htm*|*html*|*asp*|*asa*|*txt*|*inc*|*css*|*aspx*|*js*|*vbs*|*shtm*|*shtml*|*xml*|*xsl*|*log*"
' P yani resim olarak gösterilebilecek dosyalar
Const viewableExtensions = "*gif*|*jpg*|*jpeg*|*png*|*bmp*|*jpe*"
' Eðer script büyük dosyalarý upload etmezse ne kadar zamanda script bu iþlemi iptal etsin?
Server.ScriptTimeout = 300
' ------------------------------------------------------------
Const appName = "Tekersan Doküman Yönetimi"
Const appVersion = "1.0"
Dim scriptName
scriptName = Request.ServerVariables("SCRIPT_NAME")
Dim FSO
Set FSO = server.CreateObject ("Scripting.FileSystemObject")
Dim wexId
wexId = appName & appVersion & "-" & FSO.GetParentFolderName(scriptName) & "-"
Dim wexMessage, wexRootPath
Const iconFolderOpenBig = "<img align=absmiddle border=0 width=32 height=27 src=""./klasor_buyuk.gif"">"
Const iconFolderUp = "<img align=absmiddle border=0 width=15 height=13 src=""./yukari.gif"" alt=""Üst Dizin"">"
Const iconFolder = "<img align=absmiddle border=0 width=15 height=13 src=""./klasor.gif"" alt=""Klasör - Detaylarý Öðrenmek Ýçin Týklayýn"">"
Const iconFile = "<img align=absmiddle border=0 width=11 height=14 src=""./dosya.gif"" alt=""Dosya - Detaylarý Öðrenmek Ýçin Týklayýn"">"
Const iconFileEditable = "<img align=absmiddle border=0 width=11 height=14 src=""./duzenlenebilir.gif"" alt=""Metin Dosyasý - Detaylarý Öðrenmek Ýçin Týklayýn"">"
Const iconFileViewable = "<img align=absmiddle border=0 width=11 height=14 src=""./goruntulenebilir.gif"" alt=""Resim Dosyasý - Detaylarý Öðrenmek Ýçin Týklayýn"">"
Const iconRefresh = "<img align=absmiddle border=0 width=21 height=20 src=""./yenile.gif"" alt=""Dosya Görüntülemeyi Yenile"">"
Const iconCreateFile = "<img align=absmiddle border=0 width=21 height=20 src=""./dosya_olustur.gif"" alt=""Yeni Dosya Oluþtur"">"
Const iconCreateFolder = "<img align=absmiddle border=0 width=21 height=20 src=""./klasor_olustur.gif"" alt=""Yeni Klasör Oluþtur"">"
Const iconUpload = "<img align=absmiddle border=0 width=21 height=20 src=""./upload.gif"" alt=""Bu Klasöre Dosya Gönder"">"
Const iconLogout = "<img align=absmiddle border=0 width=21 height=20 src=""./cikis.gif"" alt=""Oturumu Kapat"">"
Const iconDelete = "<img align=absmiddle border=0 width=21 height=20 src=""./sil.gif"" alt=""Sil"">"
' - WebExplorer Özellikleri ------------------------------------
' Html baþlýðý yazar
Sub HtmlHeader (title, charset)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<meta http-equiv="Content-Language" content="tr">
<title><%=title%></title>
<%if Session(wexId & "Login") = true then %>
<b><font color=lightgrey>Kullanici:</font> <font color=white><%=session("user")%></font>
<%end if%>
<%HtmlStyle%>
<%HtmlJavaScript%>
</head>
<body>
<%
End Sub
' Html alt baþlýðý yazar
Sub HtmlFooter ()
%>
</body>
</html>
<%
End Sub
Sub HtmlCopyright()
%>
<table cellspacing=0 cellpadding=0 border=0 align=center><tr><td>
Tekersan Bilgi Sistemleri<a href="http://tjfabsr3/tekintranet/ti_anasayfa.asp">
Web Site</a>
</td></tr></table>
<%
End Sub
Sub HtmlStyle
%>
<style>
BODY
{
BACKGROUND-COLOR: #003366
}
TD
{
FONT-WEIGHT: normal;
FONT-SIZE: 10pt;
COLOR: white;
FONT-FAMILY: Verdana,Tahoma,Arial,Helvetica
}
.formClass
{
BACKGROUND-COLOR: #99ccff;
FONT-WEIGHT: normal;
FONT-SIZE: 10pt;
COLOR: black;
FONT-FAMILY: Verdana,Tahoma,Arial,Helvetica
}
.lightRow {
BACKGROUND-COLOR: #0066cc
}
.darkRow {
BACKGROUND-COLOR: #003399
}
.titleRow {
BACKGROUND-COLOR: black
}
.loginRow {
border: black solid 1px;
BACKGROUND-COLOR: DodgerBlue
}
.boldText
{
FONT-WEIGHT: bold
}
A
{
FONT-WEIGHT: bold;
COLOR: #99ccff;
TEXT-DECORATION: none
}
A:hover
{
COLOR: #ccffff;
TEXT-DECORATION: none
}
A:visited
{
TEXT-DECORATION: none
}
A:active
{
COLOR: #ccffff;
TEXT-DECORATION: none
}
</style>
<%
End Sub
' Java script kodu
Sub HtmlJavaScript
%>
<script language=javascript>
function Command(cmd, param) {
var str;
var someWin;
switch (cmd) {
case "NewFile":
str = prompt("Lütfen yeni dosyanýn ismini giriniz", "Yeni Dosya");
if(!str) return;
document.forms.formBuffer.parameter.value = str;
break;
case "NewFolder":
str = prompt("Lütfen yeni klasörün ismini giriniz", "Yeni Klasör");
if(!str) return;
document.forms.formBuffer.parameter.value = str;
break;
case "Edit":
str = document.forms.formBuffer.folder.value + param;
someWin = openWin(cmd + str, "", 800, 600, false, false);
someWin.focus();
createPage(someWin,cmd,param);
someWin = null;
return;
break;
case "View":
if(document.forms.formBuffer.virtual.value=="") {alert("Net baðlantýsý olmadan resim görüntülenemiyor !"); return;}
str = document.forms.formBuffer.folder.value + param;
someWin = openWin(cmd + str, "", 800, 600, false, true);
someWin.focus();
createPage(someWin,cmd,param);
someWin = null;
return;
break;
case "FileDetails":
case "FolderDetails":
str = document.forms.formBuffer.folder.value + param;
someWin = openWin(cmd + str, "", 350, 220, false, false);
someWin.focus();
createPage(someWin,cmd,param);
someWin = null;
return;
break;
case "NoDownload":
alert("Net baðlantýsý olmadan dosya indirilemiyor!");
return;
break;
case "Upload":
someWin = openWin(cmd, "", 400, 150, true, false);
someWin.focus();
createPage(someWin,cmd,param);
someWin = null;
return;
break;
case "DeleteFolder":
if (!confirm(' "' + param + '" klasörünü ve tüm içeriðini silmek istediðinizden eminmisiniz ?')) return;
document.forms.formBuffer.parameter.value = param;
break;
case "DeleteFile":
if (!confirm(' "' + param + '" dosyasýný silmek istediðinizden eminmisiniz?')) return;
document.forms.formBuffer.parameter.value = param;
break;
default:
document.forms.formBuffer.parameter.value = param;
}
document.forms.formBuffer.target = "";
document.forms.formBuffer.command.value = cmd
document.forms.formBuffer.submit();
}
function Check() {
if (document.forms.formBuffer.pwd.value == "") {
alert("Þifreyi Girmediniz!");
return false;
} else return true;
}
function openWin(winName, urlLoc, w, h, showStatus, isViewer) {
l = (screen.availWidth - w)/2;
t = (screen.availHeight - h)/2;
features = "toolbar=no"; // yes|no
features += ",location=no"; // yes|no
features += ",directories=no"; // yes|no
features += ",status=" + (showStatus?"yes":"no"); // yes|no
features += ",menubar=no"; // yes|no
features += ",scrollbars=" + (isViewer?"yes":"no"); // auto|yes|no
features += ",resizable=" + (isViewer?"yes":"no"); // yes|no
features += ",dependent"; // close the parent, close the popup, omit if you want otherwise
features += ",height=" + h;
features += ",width=" + w;
features += ",left=" + l;
features += ",top=" + t;
winName = winName.replace(/[^a-z]/gi,"_");
return window.open(urlLoc,winName,features);
}
function createPage (theWin, cmd, param){
document.forms.formBuffer.target = theWin.name;
document.forms.formBuffer.command.value = cmd;
document.forms.formBuffer.parameter.value = param;
document.forms.formBuffer.submit();
}
function EditorCommand (cmd) {
switch (cmd) {
case "Info":
alert(document.forms.formBuffer.info.value.replace(/\|/gi,"\n"));
break;
case "Reload":
document.forms.formBuffer.reset();
break;
case "Save":
document.forms.formBuffer.subcommand.value = "Kaydet";
document.forms.formBuffer.submit();
break;
case "SaveAs":
var str, oldname;
oldname = document.forms.formBuffer.parameter.value;
str = prompt("Farklý Kaydet :", oldname);
if (!str || str==oldname) return;
document.forms.formBuffer.parameter.value = str;
document.forms.formBuffer.subcommand.value = "Farklý Kaydet";
document.forms.formBuffer.submit();
break;
}
}
function ViewerCommand (cmd) {
switch (cmd) {
case "Info":
alert(document.forms.formBuffer.info.value.replace(/\|/gi,"\n"));
break;
case "Reload":
document.forms.formBuffer.submit();
break;
}
}
function Upload() {
document.forms.formBuffer.submit();
}
</script>
<%
End Sub
' a
Sub WriteListing (byref folder)
Dim item, arr
Dim rowType
Dim listed
on error resume next
%>
<form name=formGlobal action="v/noaction" onSubmit="return(false);">
<table cellspacing=0 cellpadding=0 border=0 width=100%>
<tr class=titleRow>
<td align=left> <font class=boldText><%=appName%></font> - <a href="http://<%=Request.ServerVariables("SERVER_NAME")%>" target="_blank"><%=Request.ServerVariables("SERVER_NAME")%></a></td>
<td align=right><font class=boldText>v<%=appVersion%></font> - <%=Date()%> </td>
</tr>
</table>
<table cellspacing=0 cellpadding=1 border=0 width=100%>
<tr class=lightRow height=60>
<td>
<div style="font-size:12pt;"> <%=iconFolderOpenBig%> <font class=boldText><%=folder.Name%></font></div>
<div style="font-size:8pt;"> <%=folder.path%></div>
<%If VirtualPath(destFolder)<>"" Then%>
<div style="font-size:8pt;"> (<a href="<%=VirtualPath(destFolder)%>" target="_blank"><%=VirtualPath(destFolder)%></a>)</div>
<%Else%>
<div style="font-size:8pt;"> (Net baðlantýsý yok)</div>
<%End If%>
</td>
<td nowrap>
<font class=boldText><%=folder.subfolders.count%></font> Klasör<br>
<font class=boldText><%=folder.files.count%></font> Dosya
</td>
<td nowrap>
Toplam Boyut: <font class=boldText><%If err.Number<>0 or (not calculateTotalSize) Then Response.Write "N/A" Else Response.Write FormatSize(folder.size)%></font>
</td>
<td>
<a href="javascript:Command('Refresh', '');"><%=iconRefresh%></a>
<a href="javascript:Command('NewFile', '');"><%=iconCreateFile%></a>
<a href="javascript:Command('NewFolder', '');"><%=iconCreateFolder%></a>
<a href="javascript:Command('Upload', '');"><%=iconUpload%></a>
<%If wexPassword <> "" Then%>
<a href="javascript:Command('Logout', '');"><%=iconLogout%></a>
<%
rs.Close
conn.close
End If%>
<br><input name=wexMessage type=text class=formClass size=20 value="<%=server.HTMLEncode(wexMessage)%>" Salt okunur>
</td>
<td> </td>
</tr>
<tr class=titleRow>
<td> <font class=boldText>Ýsim</font></td>
<td> <b>Boyut</b></td>
<td> <font class=boldText>Tür</font></td>
<td> <b>Düzenleme</b></td>
<td> </td>
</tr>
<%
rowType = "darkRow"
If len(destFolder) > len(wexRootPath) Then
%>
<tr class=<%=rowType%>><td> <a href="javascript:Command('LevelUp','')"><%=iconFolderUp%></a> <a href="javascript:Command('LevelUp','')">..</a></td><td> </td><td> </td><td> </td><td> </td></tr>
<%
rowType = "lightRow"
End If
listed = 0
If (folder.subfolders.Count + folder.files.Count) = 0 Then
' Do nothing when error occurs
Else
For each item in folder.subfolders
If showHiddenItems or not item.Attributes and 2 Then
listed = listed + 1
%>
<tr class=<%=rowType%>><td> <%=GetIcon(item.Name, true)%> <a href="javascript:Command('OpenFolder','<%=item.Name%>')"><%=item.Name%></a></td><td> <%If calculateFolderSize Then Response.write FormatSize(item.Size)%></td><td> <%=item.Type%></td><td nowrap> <%=item.DateLastModified%></td><td> <a href="javascript:Command('DeleteFolder','<%=item.Name%>')"><%=iconDelete%></a></td></tr>
<%
If rowType = "darkRow" Then rowType = "lightRow" Else rowType = "darkRow"
End If
Next
For each item in folder.files
If showHiddenItems or not item.Attributes and 2 Then
listed = listed + 1
%>
<tr class=<%=rowType%>><td> <%=GetIcon(item.Name, false)%> <a href="<%If VirtualPath(destFolder)<>"" Then Response.write VirtualPath(destFolder) & item.Name Else Response.Write "javascript:Command('NoDownload')"%>"><%=item.Name%></a></td><td> <%=FormatSize(item.Size)%></td><td> <%=item.Type%></td><td nowrap> <%=item.DateLastModified%></td><td> <a href="javascript:Command('DeleteFile','<%=item.Name%>')"><%=iconDelete%></a></td></tr>
<%
If rowType = "darkRow" Then rowType = "lightRow" Else rowType = "darkRow"
End If
Next
End If
%>
</table>
<table cellspacing=0 cellpadding=0 border=0 width=100%>
<tr class=titleRow>
<td> </td>
</tr>
</table>
</form>
<%
If wexMessage="" Then
If (folder.subfolders.Count + folder.files.Count) <> listed Then
wexMessage = "Listelenen " & listed & " nýn " & (folder.subfolders.Count + folder.files.Count) & " dosya , " & (folder.subfolders.Count + folder.files.Count - listed) & " dosya gizli..."
Else
wexMessage = "Listelenen " & (folder.subfolders.Count + folder.files.Count) & " dosya..."
End If
Response.Write "<script language=""javascript"">document.forms.formGlobal.wexMessage.value='" & wexMessage & "'</script>"
End If
End Sub
' Login Ekraný
Sub Login
If Request.Form("command") = "Login" Then
rs.MoveFirst
do until rs.EOF
If Request.Form("us") = rs("Afusername") Then
session("user")=rs("Afusername")
If Request.Form("pwd") =rs("Password") Then
yaz=rs("Write")
oku=rs("read")
dept=rs("dept")
session("dept")=dept
session("user")=rs("Afusername")
if session("user")="takyonxxx" then
session("admin")=true
end if
if rs("activation")=1 and yaz=1 and oku=1 or session("admin")=true then
Session(wexId & "Login") = true
Response.Redirect "indexwrite.Asp"
elseif rs("activation")=1 and oku=1 then
Session(wexId & "Login") = true
Response.Redirect "indexread.Asp"
else
Response.Redirect "yetkiyok.asp"
end if
Exit Sub
End if
End If
rs.MoveNext
loop
wexMessage="Yanlis Sifre veya Kullanici Adi!"
End If
HtmlHeader appName, wexCharSet
If(wexMessage<>"") Then Response.Write "<script language=""javascript"">alert('" & wexMessage & "');</script>"
%>
<form name=formBuffer method=post action="<%=scriptName%>" onSubmit="javascript:return(Check());">
<table border=0 cellspacing=0 cellpadding=0 width=400 align=center>
<tr><td><br><br><br></td></tr>
<tr><td>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr class=titleRow>
<td align=left>
<font class=boldText>Login</font>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr align=center class=lightRow>
<td>
<br>
<font class=boldText> <%=appName%> <%=appVersion%> 'a Hoþgeldiniz</font>
<br><br>
<table cellspacing=0 cellpadding=5 border=0 class=loginRow>
<tr>
<td align=left> <font class=boldText>Kullanici Adi</font></td>
<td align=center><input type="text" class=formClass name=us value="" size=21></td>
</tr>
<tr>
<td align=left> <font class=boldText>Þifre</font></td>
<td align=center><input type="password" class=formClass name=pwd value="" size=21></td>
</tr>
<tr>
<td align=right><input type=submit name=submitter value="Giriþ" class=formClass></td>
</tr>
</table>
<br><br> Tekersan Bilgi Sistemleri<a href="http://tjfabsr3/tekintranet/ti_anasayfa.asp">
Web Site</a> <br>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr class=titleRow>
<td align=center> </td>
</tr>
</table>
</td></tr>
</table>
<input type="hidden" name=command value="Login">
</form>
<script language="javascript">document.forms.formBuffer.pwd.focus();</script>
<%
HtmlFooter
Response.End
End Sub
' Tekrar Giriþ Mesajý
Sub PopupRelogin
Response.Write "<html><head>"
Response.Write "<title>Web Gezgini - Mesaj</title>"
Response.Write "<style>A{FONT-WEIGHT: bold; COLOR: #99ccff; TEXT-DECORATION: none}"
Response.write "A:hover{COLOR: #ccffff; TEXT-DECORATION: none }"
Response.Write "A:visited{TEXT-DECORATION: none}"
Response.write "A:active {COLOR: #ccffff; TEXT-DECORATION: none}</style>"
Response.Write "</head><body style=""BACKGROUND-COLOR: #003366"">"
Response.Write "<div style=""COLOR: white; FONT-FAMILY: Verdana,Tahoma,Arial,Helvetica; FONT-SIZE: 10pt; FONT-WEIGHT: bold;"">"
Response.Write appName & " oturum kaybedildi lütfen "
Response.write "<a href=""javascript:opener.Command('Refresh'); window.close();"">Tekrar giriþ yapýn</a>."
Response.Write "</div></body></html>"
Response.End
End Sub
' Checks if there is a valid login
Function Secure()
If wexPassword = "" Then
Secure = true
Else
If Session(wexId & "Login") Then Secure = true Else Secure = false
End If
End Function
' Oturum kapama kýsmý
Sub Logout
Session(wexId & "Login") = false
session("folderpath")=false
session("dept")=false
Session("admin") = false
Login
End Sub
' Dosya ikonuna geri döner
Function GetIcon(fileName, isFolder)
Dim ext
If isFolder Then
GetIcon = "<a href=""javascript:Command('FolderDetails', '" & fileName & "');"">" & iconFolder & "</a>"
Else
ext = FSO.GetExtensionName(fileName)
If InStr(1,editableExtensions, "*" & ext & "*", 1) <> 0 Then
GetIcon = "<a href=""javascript:Command('Edit', '" & fileName & "');"">" & iconFileEditable & "</a>"
ElseIf InStr(1,viewableExtensions, "*" & ext & "*", 1) <> 0 Then
GetIcon = "<a href=""javascript:Command('View', '" & fileName & "');"">" & iconFileViewable & "</a>"
Else
GetIcon = "<a href=""javascript:Command('FileDetails', '" & fileName & "');"">" & iconFile & "</a>"
End If
End If
End Function
' Dosya format ve boutlarý
Function FormatSize (givenSize)
If (givenSize < 1024) Then
FormatSize = givenSize & " B"
ElseIf (givenSize < 1024*1024) Then
FormatSize = FormatNumber(givenSize/1024,2) & " KB"
ElseIf (givenSize < 1024*1024*1024) Then
FormatSize = FormatNumber(givenSize/(1024*1024),2) & " MB"
Else
FormatSize = FormatNumber(givenSize/(1024*1024*1024),2) & " GB"
End If
End Function
' bb
Function FixPath(path, slash)
If Right(path, 1) <> slash Then
FixPath = path & slash
Else
FixPath = path
End If
End Function
' Fiziksel dizine çevirir
Function RealizePath(thePath)
Dim path
path = replace(thePath,"/","\")
If left(path,1) = "\" Then
on error resume next
RealizePath = FixPath(server.MapPath(path),"\")
If err.Number<>0 Then RealizePath = thePath
Else
If InStr(1,path, ":", 1) <> 0 Then
RealizePath = FixPath(path,"\")
Else
RealizePath = thePath & "?"
End If
End If
End Function
' cc
Function VirtualPath(thePath)
Dim webRoot, path
webRoot = FixPath(server.MapPath("/"),"\")
path = FixPath(thePath,"\")
VirtualPath = ""
If left(wexRoot,1) = "/" Then
VirtualPath = FixPath(wexRoot, "/")
VirtualPath = VirtualPath & right(path, len(path) - len(wexRootPath))
VirtualPath = replace(VirtualPath, "\", "/")
VirtualPath = FixPath(VirtualPath,"/")
ElseIf left(lcase(path), len(webRoot)) = lcase(webRoot) Then
VirtualPath = "/" & right(path, len(path) - len(webRoot))
VirtualPath = replace(VirtualPath, "\", "/")
VirtualPath = FixPath(VirtualPath,"/")
End If
End Function
' dd
Function SecureFileName(name)
SecureFileName = replace(name,"/","?")
SecureFileName = replace(SecureFileName,"\","?")
End Function
' Yeni dosya veya klasör oluþturmak
Function CreateItem()
Dim itemType, itemName, itemPath
itemType = Request.Form("command")
itemName = SecureFileName(Request.Form("parameter"))
itemPath = destFolder & itemName
on error resume next
Select Case itemType
Case "NewFolder"
If (FSO.FolderExists(itemPath) = false and FSO.FileExists(itemPath) = false ) Then
FSO.CreateFolder(itemPath)
If (err.Number <> 0 ) Then
CreateItem = "Klasör oluþturulamýyor""" & itemName & """, bir hata oluþtu..."
Else
CreateItem = "Bu klasör oluþturuldu""" & itemName & """..."
End If
Else
CreateItem = "Klasör oluþturulamýyor """ & itemName & """, ayný isimde baþka bir klasör veya dosya var..."
End If
Case "NewFile"
If (FSO.FolderExists(itemPath) = false and FSO.FileExists(itemPath) = false ) Then
FSO.CreateTextFile(itemPath)
If (err.Number <> 0 ) Then
CreateItem = "Dosya oluþturulamýyor""" & itemName & """, bir hata oluþtu..."
Else
CreateItem = "Dosya oluþturuldu""" & itemName & """..."
End If
Else
CreateItem = "Dosya oluþturulamýyor""" & itemName & """, ayný isimde baþka bir klasör veya dosya var..."
End IF
End Select
End Function
' Deletes a folder or a file
Function DeleteItem
Dim itemType, itemName, itemPath
itemType = Request.Form("command")
itemName = SecureFileName(Request.Form("parameter"))
itemPath = destFolder & itemName
on error resume next
Select Case itemType
Case "DeleteFolder"
FSO.DeleteFolder itemPath, true
If (err.Number <> 0 ) Then
DeleteItem = "Klasör silinemiyor""" & itemName & """, bir hata oluþtu..."
Else
DeleteItem = "Klasör silindi """ & itemName & """..."
End If
Case "DeleteFile"
FSO.DeleteFile itemPath, true
If (err.Number <> 0 ) Then
DeleteItem = "Dosya silinemiyor """ & itemName & """, bir hata oluþtu..."
Else
DeleteItem = "Dosya Silindi """ & itemName & """..."
End If
End Select
End Function
' Web Gezgini By isa SARI
Sub Editor
Dim fileName, filePath, file
If not Secure() Then PopupRelogin
on error resume next
Select Case Request.Form("subcommand")
Case "Save", "SaveAs"
fileName = SecureFileName(Request.Form("parameter"))
filePath = destFolder & fileName
Set file = FSO.OpenTextFile (filePath,2,true,0)
If (err.Number<>0) Then
wexMessage = "Dosyaya yazýlamýor""" & fileName & """, eriþim engellendi!"
err.Clear
Else
file.write Request.Form("content")
End If
Set file = Nothing
Set file = FSO.OpenTextFile (filePath,1,false,0)
Case Else
fileName = SecureFileName(Request.Form("parameter"))
filePath = destFolder & fileName
If not FSO.FileExists(filePath) Then
wexMessage = "Þu dosya """ & fileName & """ kayýp"
Set file = FSO.CreateTextFile (filePath, false, false)
If err.Number<>0 Then
wexMessage = wexMessage & ", yeni dosya oluþturulamýyor."
err.Clear
Else
wexMessage = wexMessage & ", yeni dosya oluþturuldu."
End If
Else
Set file = FSO.OpenTextFile (filePath,1,false,0)
If err.Number<>0 Then
wexMessage = "Dosya okunamýyor """ & fileName & """, eriþim engellendi!"
err.Clear
End If
End If
End Select
HtmlHeader appName, wexCharSet
If(wexMessage<>"") Then Response.Write "<script language=""javascript"">alert('" & wexMessage & "');</script>"
%>
<form name=formBuffer method=post action="<%=scriptName%>">
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr class=titleRow>
<td align=left>
<font class=boldText>Dosya Düzenleniyor</font> - <%=fileName%>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=100% height=90%>
<tr align=center class=lightRow>
<td valign=middle>
<textarea name=content class=formClass rows=22 cols=46 style="width:580; height:370;" wrap="off">
<%=Server.HTMLEncode(file.ReadAll)%></textarea>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr class=titleRow>
<td align=center>
<a href="javascript:EditorCommand('Save');">Kaydet</a> | <a href="javascript:EditorCommand('SaveAs');">Faklý Kaydet</a> | <a href="javascript:EditorCommand('Reload');">Tekrar Yükle</a> | <a href="javascript:EditorCommand('Info');">Bilgi</a> | <a href="javascript:this.close();">Kapat</a>
</td>
</tr>
</table>
<%
Set file = Nothing
Set file = FSO.GetFile (filePath)
%>
<input type="hidden" name=command value="Edit">
<input type="hidden" name=subcommand value="">
<input type="hidden" name=parameter value="<%=fileName%>">
<input type="hidden" name=folder value="<%=Request.Form("folder")%>">
<input type="hidden" name=info value="Boyut: <%=FormatSize(file.Size)%>|Tür: <%=file.Type%>|Oluþturma: <%=file.DateCreated%>|Son eriþim: <%=file.DateLastAccessed%>|Son düzenleme: <%=file.DateLastModified%>">
</form>
<%
Set file = Nothing
HtmlFooter
Response.End
End Sub
' Web Gezgini görüntüleme
Sub Viewer
Dim fileName, filePath, file, imageSrc
If not Secure() Then PopupRelogin
on error resume next
fileName = Request.Form("parameter")
filePath = destFolder & fileName
imageSrc = replace(VirtualPath(destFolder) & fileName, " ", "%20")
HtmlHeader appName, wexCharSet
%>
<form name=formBuffer method=post action="<%=scriptName%>">
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr class=titleRow>
<td align=left>
<font class=boldText>Dosya Görüntüleniyor</font> - <%=fileName%>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=100% height=90%>
<tr align=center class=lightRow>
<td valign=middle>
<img src="<%=imageSrc%>">
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr class=titleRow>
<td align=center>
<a href="javascript:ViewerCommand('Reload');">Tekrar Yükle</a> | <a href="javascript:ViewerCommand('Info');">Bilgi</a> | <a href="javascript:this.close();">Kapat</a>
</td>
</tr>
</table>
<%
Set file = FSO.GetFile (filePath)
%>
<input type="hidden" name=command value="View">
<input type="hidden" name=subcommand value="Refresh">
<input type="hidden" name=parameter value="<%=fileName%>">
<input type="hidden" name=folder value="<%=Request.Form("folder")%>">
<input type="hidden" name=info value="Boyut: <%=FormatSize(file.Size)%>|Tür: <%=file.Type%>|Oluþturma: <%=file.DateCreated%>|Son Eriþim: <%=file.DateLastAccessed%>|Son Düzenleme: <%=file.DateLastModified%>">
</form>
<%
Set file = Nothing
HtmlFooter
Response.End
End Sub
' Detaylar
Sub Details
Dim fileName, filePath, file
If not Secure() Then PopupRelogin
on error resume next
fileName = Request.Form("parameter")
filePath = destFolder & fileName
HtmlHeader appName, wexCharSet
%>
<form name=formBuffer method=post action="<%=scriptName%>">
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr class=titleRow>
<td align=left>
<font class=boldText>Detaylar</font> - <%=fileName%>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=100% height=80%>
<tr align=center class=lightRow>
<td valign=middle>
<%
If Request.Form("command") = "FileDetails" Then
Set file = FSO.GetFile (filePath)
Else
Set file = FSO.GetFolder (filePath)
End If
%>
<table border=0 cellspacing=5 cellpadding=0>
<tr><td><font class=boldText>Boyut:</font></td><td><%=FormatSize(file.Size)%></td></tr>
<tr><td><font class=boldText>Tür:</font></td><td><%=file.Type%></td></tr>
<tr><td><font class=boldText>Oluþturma:</font></td><td><%=file.DateCreated%></td></tr>
<tr><td><font class=boldText>Son Eriþim:</font></td><td><%=file.DateLastAccessed%></td></tr>
<tr><td><font class=boldText>Son Düzenleme:</font></td><td><%=file.DateLastModified%></td></tr>
</table>
<%
Set file = Nothing
%>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr class=titleRow>
<td align=center>
<a href="javascript:this.close();">Kapat</a>
</td>
</tr>
</table>
<input type="hidden" name=command value="<%=Request.Form("command")%>">
<input type="hidden" name=parameter value="<%=fileName%>">
<input type="hidden" name=folder value="<%=Request.Form("folder")%>">
</form>
<%
HtmlFooter
Response.End
End Sub
' Uploads a file
Sub Upload
If not Secure() Then PopupRelogin
If Request.QueryString("command")="DoUpload" Then
destFolder = wexRootPath & Request.QueryString("folder")
destFolder = FixPath(destFolder, "\")
If len(destFolder) < len(wexRootPath) Then Response.End
End If
HtmlHeader appName, wexCharSet
%>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr class=titleRow>
<td align=left>
<font class=boldText>Upload</font> - <%=FSO.GetBaseName(destFolder)%>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=100% height=80%>
<tr align=center class=lightRow>
<td valign=middle>
<font class=boldText>
<%
If Request.QueryString("command")="DoUpload" Then
Dim Uploader
Set Uploader = New classUploader
Uploader.Upload()
If not Uploader.uploaded Then
Response.Write "Dosya Gönderilmedi"
Else
If Uploader.uploadedFile.FileName="" Then
Response.Write "Dosya Gönderilmedi"
Else
If Uploader.uploadedFile.Save(destFolder) Then
Response.Write Uploader.uploadedFile.FileName & " gönderildi<br>"
Response.Write FormatSize(Uploader.uploadedFile.FileSize) & " (" & Uploader.uploadedFile.FileSize & " byte) yazýldý<br>"
Response.Write "<script language=""javascript"">opener.Command('Refresh');</script>"
Else
Response.Write Uploader.uploadedFile.FileName & " yazýlamadý<br>"
End If
End If
End If
%>
</font>
<form name=formBuffer method=post action="<%=scriptName%>">
<input type=hidden name=command value="Upload">
<input type=hidden name=folder value="<%=Request.QueryString("folder")%>">
</form>
<%
Else
%>
<form enctype="multipart/form-data" name=formBuffer method=post action="<%=scriptName%>?command=DoUpload&folder=<%=server.URLEncode(Request.Form("folder"))%>">
<input type=file name=file class=formClass size="20">
</form>
<%
End If
%>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr class=titleRow>
<td align=center>
<a href="javascript:Upload();">Gönder</a> | <a href="javascript:this.close();">Kapat</a>
</td>
</tr>
</table>
<%
HtmlFooter
Response.End
End Sub
' ff
Class classUploader
Public uploaded
Public uploadedFile
Public Default Sub Upload()
Dim biData, sInputName
Dim nPosBegin, nPosEnd, nPos, vDataBounds, nDataBoundPos
Dim nPosFile, nPosBound
biData = Request.BinaryRead(Request.TotalBytes)
nPosBegin = 1
nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))
If (nPosEnd-nPosBegin) <= 0 Then Exit Sub
vDataBounds = MidB(biData, nPosBegin, nPosEnd-nPosBegin)
nDataBoundPos = InstrB(1, biData, vDataBounds)
Do Until nDataBoundPos = InstrB(biData, vDataBounds & CByteString("--"))
nPos = InstrB(nDataBoundPos, biData, CByteString("Content-Disposition"))
nPos = InstrB(nPos, biData, CByteString("name="))
nPosBegin = nPos + 6
nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34)))
sInputName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
nPosFile = InstrB(nDataBoundPos, biData, CByteString("filename="))
nPosBound = InstrB(nPosEnd, biData, vDataBounds)
If nPosFile <> 0 And nPosFile < nPosBound Then
Dim sFileName
Set uploadedFile = New classUploadedFile
nPosBegin = nPosFile + 10
nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34)))
sFileName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
uploadedFile.FileName = Right(sFileName, Len(sFileName)-InStrRev(sFileName, "\"))
nPos = InstrB(nPosEnd, biData, CByteString("Content-Type:"))
nPosBegin = nPos + 14
nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))
nPosBegin = nPosEnd+4
nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2
uploadedFile.FileData = MidB(biData, nPosBegin, nPosEnd-nPosBegin)
If uploadedFile.FileSize > 0 Then uploaded = true Else uploaded = false
End If
nDataBoundPos = InstrB(nDataBoundPos + LenB(vDataBounds), biData, vDataBounds)
Loop
End Sub
' gg
Private Function CByteString(sString)
Dim index
For index = 1 to Len(sString)
CByteString = CByteString & ChrB(AscB(Mid(sString,index,1)))
Next
End Function
' hh
Private Function CWideString(bsString)
Dim index
CWideString =""
For index = 1 to LenB(bsString)
CWideString = CWideString & Chr(AscB(MidB(bsString,index,1)))
Next
End Function
End Class
' Dosya bilgisi taþýyan kýsým
Class classUploadedFile
Public FileName, FileData
Public Property Get FileSize()
FileSize = LenB(FileData)
End Property
Public Function Save(path)
Dim file
Dim index
If path = "" Or FileName = "" Then
Save = false
Exit Function
End If
path = FixPath(path, "\")
If Not FSO.FolderExists(path) Then
Save = false
Exit Function
End If
on error resume next
Set file = FSO.CreateTextFile(path & FileName, True)
For index = 1 to LenB(FileData)
file.Write Chr(AscB(MidB(FileData,index,1)))
Next
file.Close
If err.Number<>0 Then
Save = false
Else
Save = true
End If
End Function
End Class
' ------------------------------------------------------------
' - Web Gezgini Genel -----------------------------------------
Dim folder, destFolder
wexRootPath = RealizePath(wexRoot)
If Request.QueryString("command")="DoUpload" Then Upload()
destFolder = wexRootPath & Request.Form("folder")
destFolder = FixPath(destFolder, "\")
If len(destFolder) < len(wexRootPath) Then Response.End
' Actions in the popup windows
Select Case Request.Form("command")
Case "Edit"
Editor()
Case "View"
Viewer()
Case "FileDetails", "FolderDetails"
Details()
Case "Upload"
Upload()
End Select
' Ana pencere
If not Secure() Then Login
Select Case Request.Form("command")
Case "NewFile", "NewFolder"
wexMessage = CreateItem()
Case "Logout"
Logout()
Case "DeleteFile", "DeleteFolder"
wexMessage = DeleteItem()
Case "OpenFolder"
If Request.Form("folder") = "" Then
destFolder = wexRootPath & Request.Form("parameter")
Else
destFolder = wexRootPath & FixPath(Request.Form("folder"),"\") & Request.Form("parameter")
End If
destFolder = FixPath(destFolder, "\")
If len(destFolder) < len(wexRootPath) Then Response.End
Case "LevelUp"
destFolder = FSO.GetParentFolderName(destFolder)
destFolder = FixPath(destFolder, "\")
If len(destFolder) < len(wexRootPath) Then Response.End
End Select
on error resume next
Set folder = FSO.GetFolder(destFolder)
if err.Number<>0 Then wexMessage = "Klasör Açýlamýyor""" & destFolder & """"
HtmlHeader appName, wexCharSet
WriteListing (folder)
%>
<form method=post action="<%=scriptName%>" name=formBuffer>
<input type=hidden name=command value="">
<input type=hidden name=parameter value="">
<input type=hidden name=virtual value="<%=VirtualPath(destFolder)%>">
<input type=hidden name=folder value="<%=right(destFolder, len(destFolder)-len(wexRootPath))%>">
</form>
<%
Set folder = Nothing
HtmlCopyright
HtmlFooter
%>