📄 netdisk.php
字号:
if ( $rep != "" )
{
$lien .= "{$rep}/";
}
$lien .= $fichier."&id={$id}";
$affiche_copier = "non";
}
else
{
$lien = "";
if ( $rep != "" )
{
$lien .= "{$rep}/";
}
$lien .= $fichier;
$lien1 = $lien;
$lien = "javascript:popup('{$lien}')";
$affiche_copier = "oui";
}
++$LINE_COUNT;
if ( $LINE_COUNT % 2 == 1 )
{
$TableLine = "TableLine1";
}
else
{
$TableLine = "TableLine2";
}
echo "<tr class=\"".$TableLine."\">\n";
echo "<td>\n";
if ( is_editable( $fichier ) || is_image( $fichier ) || is_dir( "{$nom_rep}/{$fichier}" ) )
{
echo "<a href=\"{$lien}\">";
}
echo "<img src=\"images/".mimetype( "{$nom_rep}/{$fichier}", "image" )."\" width=\"20\" height=\"20\" align=\"ABSMIDDLE\" border=\"0\">";
echo "{$fichier}";
if ( is_editable( $fichier ) || is_image( $fichier ) || is_dir( "{$nom_rep}/{$fichier}" ) )
{
echo "</a>\n";
}
if ( stristr( $fichier, ".doc" ) || stristr( $fichier, ".ppt" ) || stristr( $fichier, ".xls" ) )
{
echo " <input type=\"button\" value=\"阅读\" class=\"SmallButton\" onClick=\"window.open('/module/OC_NETDISK?DISK_ID={$DISK_ID}&fichier=".urlencode( $lien1 )."&OP=5',null,'menubar=0,toolbar=0,status=1,scrollbars=1,resizable=1');\"> \n";
if ( find_id( $MANAGE_USER, $LOGIN_USER_ID ) )
{
echo "<input type=\"button\" value=\"编辑\" class=\"SmallButton\" onClick=\"window.open('/module/OC_NETDISK?DISK_ID={$DISK_ID}&fichier=".urlencode( $lien1 )."&OP=4',null,'menubar=0,toolbar=0,status=1,scrollbars=1,resizable=1');\"> \n";
}
}
echo "</td>\n";
echo "<td width=\"11%\" align=\"center\">";
echo taille( "{$nom_rep}/{$fichier}" );
echo "</td>\n";
echo "<td align=center width=\"15%\">";
echo mimetype( "{$nom_rep}/{$fichier}", "type" );
echo "</td>\n";
echo "<td width=\"17%\">";
echo date_modif( "{$nom_rep}/{$fichier}" );
echo "</td>\n";
echo "<td width=\"23%\"> ";
if ( find_id( $MANAGE_USER, $LOGIN_USER_ID ) )
{
if ( $affiche_copier == "oui" )
{
echo "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&action=copier&sens={$sens}&ordre={$ordre}&rep=";
if ( $rep != "" )
{
echo "{$rep}&fic={$rep}/";
}
else
{
echo "&fic=";
}
echo "{$fichier}&id={$id}\"><img src=\"images/copier.gif\" alt=\"复制\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
}
else
{
echo "<img src=\"images/pixel.gif\" width=\"20\" height=\"20\">\n";
}
if ( $affiche_copier == "oui" )
{
echo "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&action=deplacer&ordre={$ordre}&sens={$sens}&rep=";
if ( $rep != "" )
{
echo "{$rep}&fic={$rep}/";
}
else
{
echo "&fic=";
}
echo "{$fichier}&id={$id}\"><img src=\"images/deplacer.gif\" alt=\"移动\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
}
else
{
echo "<img src=\"images/pixel.gif\" width=\"20\" height=\"20\">\n";
}
echo "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&ordre={$ordre}&sens={$sens}&action=rename&rep=";
if ( $rep != "" )
{
echo "{$rep}&fic={$rep}/";
}
else
{
echo "&fic=";
}
echo "{$fichier}&id={$id}\"><img src=\"images/renommer.gif\" alt=\"重命名\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
echo "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&action=supprimer&ordre={$ordre}&sens={$sens}&rep=";
if ( $rep != "" )
{
echo "{$rep}&fic={$rep}/";
}
else
{
echo "&fic=";
}
echo "{$fichier}&id={$id}\"><img src=\"images/supprimer.gif\" alt=\"删除\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
if ( is_editable( $fichier ) && !is_dir( "{$racine}/{$fichier}" ) )
{
echo "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&ordre={$ordre}&sens={$sens}&action=editer&rep=";
if ( $rep != "" )
{
echo "{$rep}&fic={$rep}/";
}
else
{
echo "&fic=";
}
echo "{$fichier}&id={$id}\"><img src=\"images/editer.gif\" alt=\"编辑\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
}
else
{
echo "<img src=\"images/pixel.gif\" width=\"20\" height=\"20\">\n";
}
}
if ( $affiche_copier == "oui" )
{
echo "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&action=telecharger&fichier=";
if ( $rep != "" )
{
echo "{$rep}/";
}
echo "{$fichier}&id={$id}\">";
echo "<img src=\"images/download.gif\" alt=\"下载\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
}
echo "</td>\n";
echo "</tr>\n";
}
}
}
function lister_rep( $nom_rep )
{
global $rep;
global $url_racine;
global $racine;
global $mess;
global $sens;
global $user;
global $users;
global $id;
global $font;
global $tablecolor;
global $ordre;
global $poidstotal;
global $DISK_ID;
global $DISK_NAME;
if ( eregi( "\\.\\.", $rep ) )
{
$rep = "";
}
$nom_rep = init( $rep );
if ( $sens == 1 )
{
$sens = 0;
}
else
{
$sens = 1;
}
if ( $sens == 1 )
{
$sens = 0;
}
else
{
$sens = 1;
}
echo "<script language=\"javascript\">\n";
echo "function popup(lien) {\n";
echo "var fen=window.open('netdisk.php?DISK_ID={$DISK_ID}&id={$id}&action=voir&fichier='+lien,'filemanager','menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=500,height=400');\n";
echo "}\n";
echo "</script>\n";
echo "\t<div class=\"Big1\" align=\"left\">\r\n\t<b>当前目录:";
if ( $rep == "" )
{
echo $DISK_NAME;
}
else
{
echo $DISK_NAME."/".$rep;
}
echo "</b>\r\n\t</div>\r\n\r\n\t<br>\r\n\r\n\t<table border=\"0\" cellspacing=\"1\" width=\"90%\" class=\"small\" bgcolor=\"#000000\" cellpadding=\"3\" align=\"center\">\r\n";
echo "<tr class=\"TableHeader\">\n";
if ( $rep != "" )
{
$lien = "&rep=".$rep;
}
echo "<td><b><a href=\"netdisk.php?DISK_ID={$DISK_ID}&id={$id}&ordre=nom&sens={$sens}".$lien."\">{$mess['1']}</a>";
if ( $ordre == "nom" || $ordre == "" )
{
echo " <img src=\"images/fleche{$sens}.gif\" width=\"10\" height=\"10\">";
}
echo "</b></td>\n";
echo "<td align=center><b><a href=\"netdisk.php?DISK_ID={$DISK_ID}&id={$id}&ordre=taille&sens={$sens}".$lien."\">{$mess['2']}</a>";
if ( $ordre == "taille" )
{
echo " <img src=\"images/fleche{$sens}.gif\" width=\"10\" height=\"10\">";
}
echo "</b></td>\n";
echo "<td align=center><b><a href=\"netdisk.php?DISK_ID={$DISK_ID}&id={$id}&ordre=type&sens={$sens}".$lien."\">{$mess['3']}</a>";
if ( $ordre == "type" )
{
echo " <img src=\"images/fleche{$sens}.gif\" width=\"10\" height=\"10\">";
}
echo "</b></td>\n";
echo "<td align=center><b><a href=\"netdisk.php?DISK_ID={$DISK_ID}&id={$id}&ordre=mod&sens={$sens}".$lien."\">{$mess['4']}</a>\n";
if ( $ordre == "mod" )
{
echo " <img src=\"images/fleche{$sens}.gif\" width=\"10\" height=\"10\">";
}
echo "</b></td>\n";
echo "<td align=\"center\"><b>{$mess['5']}</b></td>\n";
echo "</tr>\n";
if ( $sens == 1 )
{
$sens = 0;
}
else
{
$sens = 1;
}
if ( $rep != "" )
{
$nom = dirname( $rep );
echo "<tr class=\"TableData\"><td><a href=\"netdisk.php?DISK_ID={$DISK_ID}&id={$id}&sens={$sens}&ordre={$ordre}";
if ( $rep != $nom && $nom != "." )
{
echo "&rep={$nom}";
}
echo "\"><img src=\"images/parent.gif\" width=\"20\" height=\"20\" align=\"ABSMIDDLE\" border=\"0\">{$mess['24']}</a></td><td> </td><td> </td><td> </td><td> </td></tr>\n";
}
contenu_dir( $nom_rep );
echo "<tr class=\"TableContent\">\n";
echo "<td> </td>\n";
echo "<td width=\"11%\" align=\"center\">共{$poidstotal}</td>\n";
echo "<td width=\"15%\"> </td>\n";
echo "<td width=\"17%\"> </td>\n";
echo "<td width=\"23%\"> </td>\n";
echo "</tr>\n";
echo "</table>\n<br>";
}
function deldir( $location )
{
if ( is_dir( $location ) )
{
$all = opendir( $location );
while ( $file = readdir( $all ) )
{
if ( is_dir( "{$location}/{$file}" ) && $file != ".." && $file != "." )
{
deldir( "{$location}/{$file}" );
if ( file_exists( "{$location}/{$file}" ) )
{
rmdir( "{$location}/{$file}" );
}
unset( $file );
}
else if ( !is_dir( "{$location}/{$file}" ) )
{
if ( file_exists( "{$location}/{$file}" ) )
{
unlink( "{$location}/{$file}" );
}
unset( $file );
}
}
closedir( $all );
rmdir( $location );
}
else if ( file_exists( "{$location}" ) )
{
unlink( "{$location}" );
}
}
function enlever_controlm( $fichier )
{
$fic = file( $fichier );
$fp = fopen( $fichier, "w" );
while ( list( $cle, $val ) = each( $fic ) )
{
$val = str_replace( chr( 10 ), "", $val );
$val = str_replace( chr( 13 ), "", $val );
fputs( $fp, "{$val}\n" );
}
fclose( $fp );
}
function traite_nom_fichier( $nom )
{
global $max_caracteres;
$nom = stripslashes( $nom );
$nom = str_replace( "'", "", $nom );
$nom = str_replace( "\"", "", $nom );
$nom = str_replace( "\"", "", $nom );
$nom = str_replace( "&", "", $nom );
$nom = str_replace( ",", "", $nom );
$nom = str_replace( ";", "", $nom );
$nom = str_replace( "/", "", $nom );
$nom = str_replace( "\\", "", $nom );
$nom = str_replace( "`", "", $nom );
$nom = str_replace( "<", "", $nom );
$nom = str_replace( ">", "", $nom );
$nom = str_replace( ":", "", $nom );
$nom = str_replace( "*", "", $nom );
$nom = str_replace( "|", "", $nom );
$nom = str_replace( "@", "", $nom );
$nom = str_replace( "!", "", $nom );
$nom = str_replace( "+", "", $nom );
$nom = str_replace( "^", "", $nom );
$nom = str_replace( "=", "", $nom );
$nom = str_replace( "\$", "", $nom );
$nom = str_replace( "%", "", $nom );
return $nom;
}
include_once( "inc/auth.php" );
if ( $DISK_ID == "" )
{
header( "location: index.php" );
}
$connection = openconnection( );
$query = "select * from NETDISK where DISK_ID={$DISK_ID} and (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)))";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$NEW_USER = $ROW['NEW_USER'];
$MANAGE_USER = $ROW['MANAGE_USER'];
$DISK_PATH = $ROW['DISK_PATH'];
$DISK_NAME = $ROW['DISK_NAME'];
$DISK_TYPE = $ROW['DISK_TYPE'];
$USER_ID = $ROW['USER_ID'];
$DEPT_ID = $ROW['DEPT_ID'];
}
else
{
exit( );
}
ob_end_clean( );
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Last-Modified: ".gmdate( "D, d M Y H:i:s" )." GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
include( "prive/conf.php" );
$racine = $DISK_PATH;
if ( $langue == "" )
{
$langue = $dft_langue;
}
require( "include/{$langue}.php" );
if ( file_exists( "logs/{$id}.php" ) )
{
include( "logs/{$id}.php" );
}
switch ( $action )
{
case "aide" :
include( $hautpage );
include( "include/{$langue}_help.htm" );
break;
case "telecharger" :
$NomFichier = basename( $fichier );
$taille = filesize( "{$racine}/{$fichier}" );
ob_end_clean( );
header( "Content-Type: application/force-download; name=\"{$NomFichier}\"" );
header( "Content-Transfer-Encoding: binary" );
header( "Content-Length: {$taille}" );
header( "Content-Disposition: attachment; filename=\"{$NomFichier}\"" );
header( "Expires: 0" );
header( "Cache-control: private" );
header( "Pragma: no-cache" );
readfile( "{$racine}/{$fichier}" );
exit( );
case "editer" :
if ( !connecte( $id ) )
{
header( "Location:netdisk.php" );
exit( );
}
include( $hautpage );
$code = stripslashes( $code );
if ( $save == 1 )
{
$code = str_replace( "<", "<", $code );
$fp = fopen( "{$racine}/{$fic}", "w" );
fputs( $fp, $code );
fclose( $fp );
enlever_controlm( "{$racine}/{$fic}" );
echo "\t";
echo "<s";
echo "cript>alert('文件已保存!');</script>\r\n";
}
echo "<div align=center class=big1>\n";
echo "{$mess['52']} <b>{$fic}</b><br>";
echo "<form name=\"form1\" action=\"netdisk.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"DISK_ID\" value=\"{$DISK_ID}\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\">\n";
echo "<input type=\"hidden\" name=\"fic\" value=\"{$fic}\">\n";
echo "<input type=\"hidden\" name=\"rep\" value=\"{$rep}\">\n";
echo "<input type=\"hidden\" name=\"save\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"editer\">\n";
echo "<input type=\"hidden\" name=\"ordre\" value=\"{$ordre}\">\n";
echo "<input type=\"hidden\" name=\"sens\" value=\"{$sens}\">\n";
echo "<TEXTAREA NAME=\"code\" rows=\"20\" cols=\"80\" wrap=\"OFF\" class=BigInput >\n";
$fp = fopen( "{$racine}/{$fic}", "r" );
while ( !feof( $fp ) )
{
$tmp = fgets( $fp, 4096 );
$tmp = str_replace( "<", "<", $tmp );
echo "{$tmp}";
}
fclose( $fp );
echo "{$fichier}";
echo "</TEXTAREA>\n";
echo "<br><br>\n";
echo "<input type=\"image\" src=\"images/enregistrer.gif\" alt=\"{$mess['53']}\" border=\"0\"><a href=# onclick='javascript:document.form1.submit()'><span class=Big1>{$mess['53']}</span></a>\n";
echo "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&id={$id}&rep={$rep}&ordre={$ordre}&sens={$sens}\"><img src=\"images/fermer.gif\" alt=\"{$mess['86']}\" border=\"0\"><span class=Big1>{$mess['86']}</span></a>\n";
echo "</form>\n";
echo "</div>\n";
break;
case "copier" :
if ( !connecte( $id ) )
{
header( "Location:netdisk.php" );
exit( );
}
include( $hautpage );
echo "<div align=center class=big1>\n";
echo "<table class=TableContent>\n";
echo "<tr><td><img src=\"images/copier.gif\" width=\"20\" height=\"20\" align=\"ABSMIDDLE\"> {$mess['67']} : </td><td><b>{$fic}</b></td></tr>\n";
echo "<tr><td><img src=\"images/coller.gif\" width=\"20\" height=\"20\" align=\"ABSMIDDLE\"> {$mess['68']} : </td><td>";
if ( $dest == "" )
{
echo "/";
}
else
{
echo "{$dest}";
}
echo "</td></tr>\n";
echo "</table>\n";
echo "<br>{$mess['69']} :<br><br>\n";
echo "<table class=TableContent>";
$handle = opendir( "{$racine}/{$dest}" );
while ( $fichier = readdir( $handle ) )
{
if ( $fichier == ".." )
{
$up = dirname( $dest );
if ( $up == $dest || $up == "." )
{
$up = "";
}
if ( $up != $dest )
{
echo "<td><img src=\"images/parent.gif\"></td><td><a href=\"netdisk.php?DISK_ID={$DISK_ID}&id={$id}&action=copier&ordre={$ordre}&sens={$sens}&dest={$up}&fic={$fic}&rep={$rep}\">{$mess['24']}</td>";
}
}
else if ( $fichier != ".." && $fichier != "." && is_dir( "{$racine}/{$dest}/{$fichier}" ) )
{
$liste_dir[] = $fichier;
}
}
closedir( $handle );
if ( is_array( $liste_dir ) )
{
asort( $liste_dir );
while ( list( $cle, $val ) = each( $liste_dir ) )
{
echo "<tr><td><img src=\"images/dossier.gif\"></td><td><a href=\"netdisk.php?DISK_ID={$DISK_ID}&id={$id}&action=copier&dest=";
if ( $dest != "" )
{
echo "{$dest}/";
}
echo "{$val}&rep={$rep}&ordre={$ordre}&sens={$sens}&fic={$fic}\">{$val}</a></tr>\n";
}
}
echo "</table><br>";
echo "<table>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<form action=\"netdisk.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"DISK_ID\" value=\"{$DISK_ID}\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"copier_suite\">\n";
echo "<input type=\"hidden\" name=\"fic\" value=\"{$fic}\">\n";
echo "<input type=\"hidden\" name=\"dest\" value=\"{$dest}\">\n";
echo "<input type=\"hidden\" name=\"rep\" value=\"{$rep}\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\">\n";
echo "<input type=\"hidden\" name=\"sens\" value=\"{$sens}\">\n";
echo "<input type=\"hidden\" name=\"ordre\" value=\"{$ordre}\">\n";
echo "<input type=\"submit\" class=BigButton value=\"确定\"> \n";
echo "</form>\n";
echo "</td>\n";
echo "<td>\n";
echo "<form action=\"netdisk.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"DISK_ID\" value=\"{$DISK_ID}\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\">\n";
echo "<input type=\"hidden\" name=\"rep\" value=\"{$rep}\">\n";
echo "<input type=\"hidden\" name=\"ordre\" value=\"{$ordre}\">\n";
echo "<input type=\"hidden\" name=\"sens\" value=\"{$sens}\">\n";
echo "<input type=\"submit\" class=BigButton value=\"{$mess['54']}\">\n";
echo "</form>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
break;
case "copier_suite" :
if ( !connecte( $id ) )
{
header( "Location:netdisk.php" );
exit( );
}
$destination = "{$racine}/";
if ( $dest != "" )
{
$destination .= "{$dest}/";
}
$destination .= basename( $fic );
if ( file_exists( "{$racine}/{$fic}" ) && "{$racine}/{$fic}" != $destination )
{
copy( "{$racine}/{$fic}", $destination );
}
header( "Location:netdisk.php?DISK_ID={$DISK_ID}&rep={$rep}&id={$id}&ordre={$ordre}&sens={$sens}" );
exit( );
case "voir" :
$nomdufichier = basename( $fichier );
if ( is_image( $fichier ) )
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -