📄 netdisk.php
字号:
<?php
include_once( "inc/auth.php" );
include_once( "inc/utility_all.php" );
echo "\r\n<html>\r\n<head>\r\n<title>文件选择</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n</head>\r\n\r\n<body class=\"bodycolor\" topmargin=\"5\" leftmargin=\"0\">\r\n<table border=\"0\" cellspacing=\"1\" width=\"90%\" align=\"center\" class=\"small\" bgcolor=\"#000000\" cellpadding=\"3\">\r\n<form name=\"form1\" action=\"netdisk_submit.php\">\r\n <tr class=\"TableData\" height=\"60\">\r\n <td valign=\"top\">\r\n";
$COUNT = 0;
if ( $DISK_ID == "" )
{
$query = "SELECT * from NETDISK where DISK_TYPE='1' or (DISK_TYPE='2' and DEPT_ID=".$LOGIN_DEPT_ID.") or (DISK_TYPE='3' and (InStr(USER_ID,',{$LOGIN_USER_ID},')>0 or InStr(USER_ID,'{$LOGIN_USER_ID},')=1)) order by DISK_NO,DISK_TYPE desc";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$DISK_ID1 = $ROW['DISK_ID'];
$DISK_NAME = $ROW['DISK_NAME'];
$DISK_PATH = $ROW['DISK_PATH'];
$DISK_NAME == htmlspecialchars( $DISK_NAME );
++$COUNT;
echo " <a href=\"netdisk.php?EXT_FILTER=";
echo $EXT_FILTER;
echo "&DISK_ID=";
echo $DISK_ID1;
echo "&PARENT_ID=";
echo $DISK_ID;
echo "&DIV_ID=";
echo $DIV_ID;
echo "&DIR_FIELD=";
echo $DIR_FIELD;
echo "&NAME_FIELD=";
echo $NAME_FIELD;
echo "&TYPE_FIELD=";
echo $TYPE_FIELD;
echo "&MULTI_SELECT=";
echo $MULTI_SELECT;
echo "\"><img src=\"/general/netdisk/images/dossier.gif\" align=\"absMiddle\" border=\"0\"> ";
echo $DISK_NAME;
echo "</a><br>\r\n ";
}
if ( $COUNT == 0 )
{
message( "", "无可访问目录" );
}
$CUR_POS = "网络硬盘";
}
else
{
$query = "select * from NETDISK where DISK_ID=".$DISK_ID;
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$DISK_PATH = $ROW['DISK_PATH'];
$DISK_NAME = $ROW['DISK_NAME'];
}
else
{
message( "错误", "未找到指定的目录" );
echo " <br>\r\n <div align=\"center\">\r\n <input type=\"button\" value=\"关闭\" class=\"BigButton\" onClick=\"window.close();\">\r\n </div>\r\n ";
exit( );
}
$CUR_POS = $DISK_NAME.$SUB_DIR;
if ( $SUB_DIR != "" )
{
$SUB_DIR = urldecode( $SUB_DIR );
}
$SUBDIR = urlencode( substr( $SUB_DIR, 0, strrpos( $SUB_DIR, "/" ) ) );
if ( $SUB_DIR == "" )
{
echo " \r\n <a href=\"netdisk.php?EXT_FILTER=";
echo $EXT_FILTER;
echo "&DISK_ID=";
echo $PARENT_ID;
echo "&SUB_DIR=&DIV_ID=";
echo $DIV_ID;
echo "&DIR_FIELD=";
echo $DIR_FIELD;
echo "&NAME_FIELD=";
echo $NAME_FIELD;
echo "&TYPE_FIELD=";
echo $TYPE_FIELD;
echo "&MULTI_SELECT=";
echo $MULTI_SELECT;
echo "\"><img src=\"/general/netdisk/images/parent.gif\" align=\"absMiddle\" border=\"0\"> 返回上级目录</a><br>\r\n";
}
else
{
echo " \r\n <a href=\"netdisk.php?EXT_FILTER=";
echo $EXT_FILTER;
echo "&DISK_ID=";
echo $DISK_ID;
echo "&SUB_DIR=";
echo $SUBDIR;
echo "&DIV_ID=";
echo $DIV_ID;
echo "&DIR_FIELD=";
echo $DIR_FIELD;
echo "&NAME_FIELD=";
echo $NAME_FIELD;
echo "&TYPE_FIELD=";
echo $TYPE_FIELD;
echo "&MULTI_SELECT=";
echo $MULTI_SELECT;
echo "\"><img src=\"/general/netdisk/images/parent.gif\" align=\"absMiddle\" border=\"0\"> 返回上级目录</a><br>\r\n";
}
$CUR_DIR = $DISK_PATH."/".$SUB_DIR;
$CUR_DIR = str_replace( "//", "/", $CUR_DIR );
if ( !file_exists( $CUR_DIR ) )
{
message( "错误", "未找到指定的目录" );
echo " <br>\r\n <div align=\"center\">\r\n <input type=\"button\" value=\"关闭\" class=\"BigButton\" onClick=\"window.close();\">\r\n </div>\r\n ";
exit( );
}
$SORT_COUNT = 0;
$FILE_COUNT = 0;
$SORT_ATTR_ARRAY = array( );
$FILE_ATTR_ARRAY = array( );
$dh = opendir( $CUR_DIR );
while ( false !== ( $FILE_NAME = readdir( $dh ) ) )
{
if ( $FILE_NAME == "." || $FILE_NAME == ".." )
{
if ( is_file( $CUR_DIR."/".$FILE_NAME ) )
{
if ( $EXT_FILTER != "" && !find_id( substr( $FILE_NAME, strrpos( $FILE_NAME, "." ) + 1 ), $EXT_FILTER ) )
{
$FILE_ATTR_ARRAY[$FILE_COUNT] = $FILE_NAME;
++$FILE_COUNT;
}
}
else
{
$SORT_ATTR_ARRAY[$SORT_COUNT] = $FILE_NAME;
++$SORT_COUNT;
}
}
}
sort( &$SORT_ATTR_ARRAY );
sort( &$FILE_ATTR_ARRAY );
$I = 0;
for ( ; $I < count( $SORT_ATTR_ARRAY ); ++$I )
{
$SUBDIR = urlencode( $SUB_DIR."/" ).$SORT_ATTR_ARRAY[$I];
echo " <a href=\"netdisk.php?EXT_FILTER=";
echo $EXT_FILTER;
echo "&DISK_ID=";
echo $DISK_ID;
echo "&SUB_DIR=";
echo $SUBDIR;
echo "&DIV_ID=";
echo $DIV_ID;
echo "&DIR_FIELD=";
echo $DIR_FIELD;
echo "&NAME_FIELD=";
echo $NAME_FIELD;
echo "&TYPE_FIELD=";
echo $TYPE_FIELD;
echo "&MULTI_SELECT=";
echo $MULTI_SELECT;
echo "\"><img src=\"/general/netdisk/images/dossier.gif\" align=\"absMiddle\" border=\"0\"> ";
echo $SORT_ATTR_ARRAY[$I];
echo "</a><br>\r\n";
}
$I = 0;
for ( ; $I < count( $FILE_ATTR_ARRAY ); ++$I )
{
echo " <a id=\"FILE_";
echo $I;
echo "\" href=\"javascript:SelFile(";
echo $I;
echo ")\"><img src=\"/general/netdisk/images/defaut.gif\" align=\"absMiddle\" border=\"0\"> ";
echo $FILE_ATTR_ARRAY[$I];
echo "</a><br>\r\n";
}
echo "<script>\r\nvar ParentWindow=parent.opener.window;\r\nvar FileArray = new Array();\r\n";
$I = 0;
for ( ; $I < count( $FILE_ATTR_ARRAY ); ++$I )
{
echo "FileArray[";
echo $I;
echo "] = escape(\"";
echo $FILE_ATTR_ARRAY[$I];
echo "\");\r\n";
}
echo "function SelFile(i)\r\n{\r\n if(!ParentWindow.document.all(\"";
echo $DIR_FIELD;
echo "\") || !ParentWindow.document.all(\"";
echo $NAME_FIELD;
echo "\") || !ParentWindow.document.all(\"";
echo $TYPE_FIELD;
echo "\") || !ParentWindow.document.getElementById(\"";
echo $DIV_ID;
echo "\"))\r\n return;\r\n\r\n var DirArray = new Array();\r\n var NameArray = new Array();\r\n var TypeArray = new Array();\r\n \r\n if(ParentWindow.document.all(\"";
echo $DIR_FIELD;
echo "\"))\r\n DirArray=ParentWindow.document.all(\"";
echo $DIR_FIELD;
echo "\").value.split(\"*\");\r\n if(ParentWindow.document.all(\"";
echo $NAME_FIELD;
echo "\"))\r\n NameArray=ParentWindow.document.all(\"";
echo $NAME_FIELD;
echo "\").value.split(\"*\");\r\n if(ParentWindow.document.all(\"";
echo $TYPE_FIELD;
echo "\"))\r\n TypeArray=ParentWindow.document.all(\"";
echo $TYPE_FIELD;
echo "\").value.split(\"*\");\r\n \r\n var DirValue=\"\";\r\n var NameValue=\"\";\r\n var TypeValue=\"\";\r\n var DivInnerHTML=\"\";\r\n var flag=0;\r\n for(j=0;j<NameArray.length;j++)\r\n {\r\n if(NameArray[j]==\"\")\r\n continue;\r\n if(DirArray[j]==\"";
echo $SUB_DIR;
echo "\" && NameArray[j]==unescape(FileArray[i]) && TypeArray[j]==\"";
echo $DISK_ID;
echo "\")\r\n {\r\n flag=1;\r\n continue;\r\n }\r\n \r\n DirValue+=DirArray[j]+\"*\";\r\n NameValue+=NameArray[j]+\"*\";\r\n TypeValue+=TypeArray[j]+\"*\";\r\n DivInnerHTML+=NameArray[j]+\"<br>\";\r\n }\r\n";
if ( $MULTI_SELECT )
{
echo " \r\n if(flag==1)\r\n {\r\n ParentWindow.document.all(\"";
echo $DIR_FIELD;
echo "\").value=DirValue;\r\n ParentWindow.document.all(\"";
echo $NAME_FIELD;
echo "\").value=NameValue;\r\n ParentWindow.document.all(\"";
echo $TYPE_FIELD;
echo "\").value=TypeValue;\r\n ParentWindow.document.getElementById(\"";
echo $DIV_ID;
echo "\").innerHTML=DivInnerHTML;\r\n document.getElementById(\"FILE_\"+i).style.color=\"#0000FF\";\r\n }\r\n else\r\n {\r\n ParentWindow.document.all(\"";
echo $DIR_FIELD;
echo "\").value+=\"";
echo $SUB_DIR;
echo "*\";\r\n ParentWindow.document.all(\"";
echo $NAME_FIELD;
echo "\").value+=unescape(FileArray[i])+\"*\";\r\n ParentWindow.document.all(\"";
echo $TYPE_FIELD;
echo "\").value+=\"";
echo $DISK_ID;
echo "*\";\r\n ParentWindow.document.getElementById(\"";
echo $DIV_ID;
echo "\").innerHTML+=unescape(FileArray[i])+\"<br>\";\r\n document.getElementById(\"FILE_\"+i).style.color=\"gray\";\r\n }\r\n";
}
else
{
echo " if(flag==1)\r\n {\r\n ParentWindow.document.all(\"";
echo $DIR_FIELD;
echo "\").value=\"\";\r\n ParentWindow.document.all(\"";
echo $NAME_FIELD;
echo "\").value=\"\";\r\n ParentWindow.document.all(\"";
echo $TYPE_FIELD;
echo "\").value=\"\";\r\n ParentWindow.document.getElementById(\"";
echo $DIV_ID;
echo "\").innerHTML=\"\";\r\n document.getElementById(\"FILE_\"+i).style.color=\"#0000FF\";\r\n }\r\n else\r\n {\r\n ParentWindow.document.all(\"";
echo $DIR_FIELD;
echo "\").value=\"";
echo $SUB_DIR;
echo "\";\r\n ParentWindow.document.all(\"";
echo $NAME_FIELD;
echo "\").value=unescape(FileArray[i]);\r\n ParentWindow.document.all(\"";
echo $TYPE_FIELD;
echo "\").value=\"";
echo $DISK_ID;
echo "\";\r\n ParentWindow.document.getElementById(\"";
echo $DIV_ID;
echo "\").innerHTML=unescape(FileArray[i]);\r\n document.getElementById(\"FILE_\"+i).style.color=\"gray\";\r\n }\r\n";
}
echo "}\r\n\r\nfunction DoLoad()\r\n{\r\n var DirArray = new Array();\r\n var NameArray = new Array();\r\n var TypeArray = new Array();\r\n \r\n if(ParentWindow.document.all(\"";
echo $DIR_FIELD;
echo "\"))\r\n DirArray=ParentWindow.document.all(\"";
echo $DIR_FIELD;
echo "\").value.split(\"*\");\r\n if(ParentWindow.document.all(\"";
echo $NAME_FIELD;
echo "\"))\r\n NameArray=ParentWindow.document.all(\"";
echo $NAME_FIELD;
echo "\").value.split(\"*\");\r\n if(ParentWindow.document.all(\"";
echo $TYPE_FIELD;
echo "\"))\r\n TypeArray=ParentWindow.document.all(\"";
echo $TYPE_FIELD;
echo "\").value.split(\"*\");\r\n \r\n for(i=0;i<FileArray.length;i++)\r\n {\r\n for(j=0;j<NameArray.length;j++)\r\n {\r\n if(NameArray[j]==\"\")\r\n continue;\r\n if(DirArray[j]==\"";
echo $SUB_DIR;
echo "\" && NameArray[j]==unescape(FileArray[i]) && TypeArray[j]==\"";
echo $DISK_ID;
echo "\")\r\n {\r\n document.getElementById(\"FILE_\"+i).style.color=\"gray\";\r\n break;\r\n }\r\n }\r\n }\r\n}\r\nDoLoad();\r\n</script>\r\n";
}
echo " </td>\r\n </tr>\r\n <tr>\r\n <td nowrap align=\"center\" class=\"TableControl\">\r\n <input type=\"button\" value=\"关闭\" class=\"BigButton\" onClick=\"parent.window.close();\">\r\n </td>\r\n </tr>\r\n <thead>\r\n <td class=\"TableHeader\">\r\n <img src=\"/images/green_arrow.gif\" align=\"absMiddle\" WIDTH=\"20\" HEIGHT=\"18\"> ";
echo $CUR_POS;
echo " </td>\r\n </thead>\r\n</form>\r\n</table>\r\n\r\n</body>\r\n</html>\r\n";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -