if
(
$_GET
[folder] !=
""
)
{
$folder_current
=
$VOLUME
.
$_GET
[folder];
if
(!
is_dir
(
$folder_current
))
{
$folder_current
=
$VOLUME
;
}
chdir
(
$folder_current
);
$folder_current
=
getcwd
();
if
(
substr
(
$folder_current
, 0,
strlen
(
$VOLUME
)) !=
$VOLUME
)
{
chdir
(
$VOLUME
);
}
}
else
{
$folder_current
=
getcwd
();
}
$folder_handle
= opendir(
$folder_current
);
$file_array
=
array
();
$folder_array
=
array
();
if
(
$folder_handle
)
{
while
(
$file
= readdir(
$folder_handle
))
{
if
(
$file
==
"."
||
$file
==
".."
)
{
if
(
$VOLUME
!=
$folder_current
.
"/"
)
{
$file_folder
=
substr
(
$folder_current
,
strlen
(
$VOLUME
),
strlen
(
$folder_current
));
array_push
(
$folder_array
,
array
(
$file_folder
.
"/"
.
$file
,
$file
));
}
}
else
if
(
is_dir
(
$file
)&&
$file
!=
"temp"
)
{
$file_folder
=
substr
(
$folder_current
,
strlen
(
$VOLUME
),
strlen
(
$folder_current
));
if
(
$file_folder
)
{
array_push
(
$folder_array
,
array
(
$file_folder
.
"/"
.
$file
,
$file
));
}
else
{
array_push
(
$folder_array
,
array
(
$file
,
$file
));
}
}
else
if
(
is_file
(
$file
) &&
$file
!=
"index.php"
&&
$file
!=
"index.php.bak"
)
{
$file_size
=(int)(
filesize
(
$folder_current
.
"/"
.
$file
) / 1024);
$file_time
=
date
(
"y-m-d H:i"
,
filemtime
(
$folder_current
.
"/"
.
$file
));
$file_sum
+=
$file_size
;
$file_folder
=
substr
(
$folder_current
,
strlen
(
$VOLUME
),
strlen
(
$folder_current
));
if
(
$file_folder
)
{
array_push
(
$file_array
,
array
(
$file_folder
.
"/"
.
$file
,
$file
,
$file_size
,
$file_time
));
}
else
{
array_push
(
$file_array
,
array
(
$file
,
$file
,
$file_size
,
$file_time
));
}
}
}
closedir
(
$folder_handle
);
usort(
$folder_array
,
'mycmp'
);
usort(
$file_array
,
'mycmp'
);
}