📄 search.php
字号:
global $ordre;
global $rep;
global $rep1;
global $poidstotal;
global $LINE_COUNT;
global $RESULT_ARRAY;
global $MANAGE_USER;
global $LOGIN_USER_ID;
global $DISK_ID;
global $DISK_PATH;
global $ATTACHMENT_NAME;
global $key;
global $SEARCH_DOC;
list( $liste, $poidstotal ) = listing( $nom_rep );
if ( is_array( $liste ) )
{
while ( list( $fichier, $mime ) = each( $liste ) )
{
$nom_rep = str_replace( "//", "/", $nom_rep );
$str = $DISK_PATH."/".$rep;
$str = str_replace( "//", "/", $str );
$rep1 = str_replace( $str, "", $nom_rep );
if ( is_dir( "{$nom_rep}/{$fichier}" ) )
{
contenu_dir( "{$nom_rep}/{$fichier}" );
continue;
}
else
{
if ( $ATTACHMENT_NAME == "" && !stristr( $fichier, ".doc" ) && !stristr( $fichier, ".htm" ) && !stristr( $fichier, ".html" ) && !stristr( $fichier, ".txt" ) )
{
}
else
{
$lien = "";
if ( $rep != "" )
{
$lien .= "{$rep}/";
}
$lien .= $rep1."/".$fichier;
$lien1 = $lien;
$FLAG = 0;
if ( $ATTACHMENT_NAME != "" && stristr( $fichier, $ATTACHMENT_NAME ) )
{
$FLAG = 1;
}
$res[0] = "";
if ( $FLAG != 1 && $key != "" )
{
if ( substr( $DISK_PATH, -1 ) == "/" )
{
$newpath = $DISK_PATH.$lien;
}
else
{
$newpath = $DISK_PATH."/".$lien;
}
$msg = "";
if ( stristr( $fichier, ".doc" ) && $SEARCH_DOC == "on" )
{
$msg = doc2txt( $newpath );
}
else if ( stristr( $fichier, ".htm" ) || stristr( $fichier, ".html" ) )
{
$msg = file_get_contents( $newpath );
$msg = strip_tags( $msg );
}
else if ( stristr( $fichier, ".txt" ) )
{
$msg = file_get_contents( $newpath );
}
$msg = str_replace( " ", "", $msg );
$msg = preg_replace( "/<[^>]+>/", "", $msg );
$FLAG = preg_match( "/.*{$key}.*/i", $msg, $res );
}
if ( $FLAG != 1 )
{
}
else
{
$res[0] = preg_replace( "/{$key}/i", "<FONT COLOR=\"red\">{$key}</FONT>", $res[0] );
$lien = "javascript:popup('{$lien}')";
$affiche_copier = "oui";
}
}
}
++$LINE_COUNT;
if ( $LINE_COUNT % 2 == 1 )
{
$TableLine = "TableLine1";
}
else
{
$TableLine = "TableLine2";
}
$RESULT_ARRAY[$LINE_COUNT] .= "<tr class=\"TableLine1\">\n";
$RESULT_ARRAY[$LINE_COUNT] .= "<td>\n<b>{$LINE_COUNT}.</b>";
if ( is_editable( $fichier ) || is_image( $fichier ) || is_dir( "{$nom_rep}/{$fichier}" ) )
{
$RESULT_ARRAY[$LINE_COUNT] .= "<a href=\"{$lien}\">";
}
$RESULT_ARRAY[$LINE_COUNT] .= "<img src=\"images/".mimetype( "{$nom_rep}/{$fichier}", "image" )."\" width=\"20\" height=\"20\" align=\"ABSMIDDLE\" border=\"0\">";
$RESULT_ARRAY[$LINE_COUNT] .= "{$fichier}";
if ( is_editable( $fichier ) || is_image( $fichier ) || is_dir( "{$nom_rep}/{$fichier}" ) )
{
$RESULT_ARRAY[$LINE_COUNT] .= "</a>\n";
}
if ( stristr( $fichier, ".doc" ) || stristr( $fichier, ".ppt" ) || stristr( $fichier, ".xls" ) )
{
$RESULT_ARRAY[$LINE_COUNT] .= " <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 ) )
{
$RESULT_ARRAY[$LINE_COUNT] .= "<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";
}
}
$RESULT_ARRAY[$LINE_COUNT] .= "</td>\n";
$RESULT_ARRAY[$LINE_COUNT] .= "<td align=\"center\">";
$RESULT_ARRAY[$LINE_COUNT] .= taille( "{$nom_rep}/{$fichier}" );
$RESULT_ARRAY[$LINE_COUNT] .= "</td>\n";
$RESULT_ARRAY[$LINE_COUNT] .= "<td align=center>";
$RESULT_ARRAY[$LINE_COUNT] .= date_modif( "{$nom_rep}/{$fichier}" );
$RESULT_ARRAY[$LINE_COUNT] .= "</td>\n";
$RESULT_ARRAY[$LINE_COUNT] .= "<td align=\"center\"> ";
if ( find_id( $MANAGE_USER, $LOGIN_USER_ID ) )
{
if ( $affiche_copier == "oui" )
{
$RESULT_ARRAY[$LINE_COUNT] .= "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&action=copier&sens={$sens}&ordre={$ordre}&rep=";
if ( $rep != "" )
{
$RESULT_ARRAY[$LINE_COUNT] .= "{$rep}&fic={$rep}{$rep1}/";
}
else
{
$RESULT_ARRAY[$LINE_COUNT] .= "&fic=";
}
$RESULT_ARRAY[$LINE_COUNT] .= "{$fichier}&id={$id}\"><img src=\"images/copier.gif\" alt=\"复制\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
}
else
{
$RESULT_ARRAY[$LINE_COUNT] .= "<img src=\"images/pixel.gif\" width=\"20\" height=\"20\">\n";
}
if ( $affiche_copier == "oui" )
{
$RESULT_ARRAY[$LINE_COUNT] .= "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&action=deplacer&ordre={$ordre}&sens={$sens}&rep=";
if ( $rep != "" )
{
$RESULT_ARRAY[$LINE_COUNT] .= "{$rep}&fic={$rep}{$rep1}/";
}
else
{
$RESULT_ARRAY[$LINE_COUNT] .= "&fic=";
}
$RESULT_ARRAY[$LINE_COUNT] .= "{$fichier}&id={$id}\"><img src=\"images/deplacer.gif\" alt=\"移动\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
}
else
{
$RESULT_ARRAY[$LINE_COUNT] .= "<img src=\"images/pixel.gif\" width=\"20\" height=\"20\">\n";
}
$RESULT_ARRAY[$LINE_COUNT] .= "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&ordre={$ordre}&sens={$sens}&action=rename&rep=";
if ( $rep != "" )
{
$RESULT_ARRAY[$LINE_COUNT] .= "{$rep}&fic={$rep}{$rep1}/";
}
else
{
$RESULT_ARRAY[$LINE_COUNT] .= "&fic=";
}
$RESULT_ARRAY[$LINE_COUNT] .= "{$fichier}&id={$id}\"><img src=\"images/renommer.gif\" alt=\"重命名\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
$RESULT_ARRAY[$LINE_COUNT] .= "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&action=supprimer&ordre={$ordre}&sens={$sens}&rep=";
if ( $rep != "" )
{
$RESULT_ARRAY[$LINE_COUNT] .= "{$rep}&fic={$rep}{$rep1}/";
}
else
{
$RESULT_ARRAY[$LINE_COUNT] .= "&fic=";
}
$RESULT_ARRAY[$LINE_COUNT] .= "{$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}" ) )
{
$RESULT_ARRAY[$LINE_COUNT] .= "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&ordre={$ordre}&sens={$sens}&action=editer&rep=";
if ( $rep != "" )
{
$RESULT_ARRAY[$LINE_COUNT] .= "{$rep}&fic={$rep}{$rep1}/";
}
else
{
$RESULT_ARRAY[$LINE_COUNT] .= "&fic=";
}
$RESULT_ARRAY[$LINE_COUNT] .= "{$fichier}&id={$id}\"><img src=\"images/editer.gif\" alt=\"编辑\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
}
else
{
$RESULT_ARRAY[$LINE_COUNT] .= "<img src=\"images/pixel.gif\" width=\"20\" height=\"20\">\n";
}
}
if ( $affiche_copier == "oui" )
{
$RESULT_ARRAY[$LINE_COUNT] .= "<a href=\"netdisk.php?DISK_ID={$DISK_ID}&action=telecharger&fichier=";
if ( $rep != "" )
{
$RESULT_ARRAY[$LINE_COUNT] .= "{$rep}{$rep1}/";
}
$RESULT_ARRAY[$LINE_COUNT] .= "{$fichier}&id={$id}\">";
$RESULT_ARRAY[$LINE_COUNT] .= "<img src=\"images/download.gif\" alt=\"下载\" width=\"20\" height=\"20\" border=\"0\"></a>\n";
}
$RESULT_ARRAY[$LINE_COUNT] .= "</td>\n";
$RESULT_ARRAY[$LINE_COUNT] .= "</tr>\n";
$RESULT_ARRAY[$LINE_COUNT] .= "<tr class=\"TableLine2\" height=\"30\">\n";
$RESULT_ARRAY[$LINE_COUNT] .= "<td colspan=\"4\">\n";
$RESULT_ARRAY[$LINE_COUNT] .= $res[0];
$RESULT_ARRAY[$LINE_COUNT] .= "</td>\n";
$RESULT_ARRAY[$LINE_COUNT] .= "</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 );
$nom_rep = str_replace( "//", "/", $nom_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=\"0\" width=\"95%\" class=\"small\" bgcolor=\"#000000\" cellpadding=\"3\" align=\"center\">\r\n";
echo "<tr class=\"TableHeader\">\n";
if ( $rep != "" )
{
$lien = "&rep=".$rep;
}
echo "<td><b>{$mess['1']}</b></td>\n";
echo "<td width=\"11%\" align=center><b>{$mess['2']}</b></td>\n";
echo "<td width=\"20%\" align=center><b>{$mess['4']}</b></td>\n";
echo "<td width=\"22%\" align=\"center\"><b>{$mess['5']}</b></td>\n";
echo "</tr>\n";
if ( $sens == 1 )
{
$sens = 0;
}
else
{
$sens = 1;
}
contenu_dir( $nom_rep );
}
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" );
include_once( "inc/utility_all.php" );
$ATTACHMENT_NAME = strtolower( $ATTACHMENT_NAME );
$rep = $REP;
$key = chop( $key );
$connection = openconnection( );
$query = "select * from NETDISK where DISK_ID={$DISK_ID}";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$MANAGE_USER = $ROW['MANAGE_USER'];
$DISK_PATH = $ROW['DISK_PATH'];
$DISK_NAME = $ROW['DISK_NAME'];
}
$LINE_COUNT = 0;
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";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -