include_once 'function.php';
$title = !IS_INSTALL_ROOT_DIRECTORY ? 'List' : 'File Manager error';
$dir = NOT_PERMISSION == false && isset($_GET['dir']) && empty($_GET['dir']) == false ? rawurldecode($_GET['dir']) : $_SERVER['DOCUMENT_ROOT'];
$dir = processDirectory($dir);
include_once 'header.php';
if (!IS_INSTALL_ROOT_DIRECTORY) {
$handler = @scandir($dir);
if ($handler === false) {
$dir = $_SERVER['DOCUMENT_ROOT'];
$dir = processDirectory($dir);
$handler = @scandir($dir);
$dirEncode = rawurlencode($dir);
$count = count($handler);
if (!IS_INSTALL_ROOT_DIRECTORY && $count > 0) {
foreach ($handler as $entry) {
if ($entry != '.' && $entry != '..') {
if ($entry == DIRECTORY_FILE_MANAGER && IS_ACCESS_PARENT_PATH_FILE_MANAGER) ;
/* Is hide directory File Manager */
elseif (is_dir($dir . '/' . $entry))
if (count($folders) > 0) {
foreach ($folders as $entry)
$lists[] = array('name' => $entry, 'is_directory' => true);
foreach ($files as $entry)
$lists[] = array('name' => $entry, 'is_directory' => false);
if (!IS_INSTALL_ROOT_DIRECTORY && $dir != '/' && strpos($dir, '/') !== false) {
$array = explode('/', preg_replace('|^/(.*?)$|', '\1', $dir));
foreach ($array as $key => $entry) {
$seperator = preg_match('|^\/(.*?)$|', $dir) ? '/' : null;
$item = $seperator . $entry;
if ($key < count($array) - 1)
$html .= '/<a href="index.php?dir=' . rawurlencode($url . $item) . '">';
$html .= substring($entry, 0, NAME_SUBSTR, NAME_SUBSTR_ELLIPSIS);
if ($key < count($array) - 1)
if (!IS_INSTALL_ROOT_DIRECTORY) {
echo '<script language="javascript" src="checkbox.js"></script>';
echo '<div class="title">' . $html . '</div>';
if (IS_INSTALL_ROOT_DIRECTORY) {
echo '<div class="title">File Manager error</div>
<div class="list">You are Setting File Manager on the original Folder, please move it to a Folder</div>';
} elseif (IS_ACCESS_FILE_IN_FILE_MANAGER) {
echo '<div class="notice_info">You cannot See File of File Manager it has been blocked</div>';
echo '<div class="notice_info">You cannot view the folder of File Manager it has been blocked</div>';
if (!IS_INSTALL_ROOT_DIRECTORY) {
echo '<form action="action.php?dir=' . $dirEncode . $pages['paramater_1'] . '" method="post" name="form"><ul class="list_file">';
if (preg_replace('|[a-zA-Z]+:|', '', str_replace('\\', '/', $dir)) != '/') {
$path = strrchr($dir, '/');
$path = 'index.php?dir=' . rawurlencode(substr($dir, 0, strlen($dir) - strlen($path)));
echo '<li class="normal">
<img src="icon/back.png" style="margin-left: 5px; margin-right: 5px"/>
<strong class="back">...</strong>
echo '<li class="normal"><img src="icon/empty.png"/> <span class="empty">No Folders or Files</span></li>';
if (isset($configs['page_list']) && $configs['page_list'] > 0 && $count > $configs['page_list']) {
$pages['total'] = ceil($count / $configs['page_list']);
if ($pages['total'] <= 0 || $pages['current'] > $pages['total'])
goURL('index.php?dir=' . $dirEncode . ($pages['total'] <= 0 ? null : '&page_list=' . $pages['total']));
$start = ($pages['current'] * $configs['page_list']) - $configs['page_list'];
$end = $start + $configs['page_list'] >= $count ? $count : $start + $configs['page_list'];
for ($i = $start; $i < $end; ++$i) {
$name = $lists[$i]['name'];
$path = $dir . '/' . $name;
$perms = getChmod($path);
if ($lists[$i]['is_directory']) {
echo '<li class="folder">
<input type="checkbox" name="entry[]" value="' . $name . '"/>
<a href="folder_edit.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">
<img src="icon/folder.png"/>
<a href="index.php?dir=' . rawurlencode($path) . '">' . $name . '</a>
<a href="folder_chmod.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '" class="chmod">' . $perms . '</a>
$edit = array(null, '</a>');
$type = getFormat($name);
if (in_array($type, $formats['other'])) {
} elseif (in_array($type, $formats['text'])) {
} elseif (in_array($type, $formats['archive'])) {
} elseif (in_array($type, $formats['audio'])) {
} elseif (in_array($type, $formats['font'])) {
} elseif (in_array($type, $formats['binary'])) {
} elseif (in_array($type, $formats['document'])) {
} elseif (in_array($type, $formats['image'])) {
} elseif (in_array(strtolower(strpos($name, '.') !== false ? substr($name, 0, strpos($name, '.')) : $name), $formats['source'])) {
$icon = strtolower(strpos($name, '.') !== false ? substr($name, 0, strpos($name, '.')) : $name);
} elseif (isFormatUnknown($name)) {
if (strtolower($name) == 'error_log' || $isEdit)
$edit[0] = '<a href="edit_text.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">';
elseif (in_array($type, $formats['zip']))
$edit[0] = '<a href="file_unzip.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">';
$edit[0] = '<a href="file_rename.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">';
<input type="checkbox" name="entry[]" value="' . $name . '"/>
' . $edit[0] . '<img src="icon/mime/' . $icon . '.png"/>' . $edit[1] . '
<a href="file.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">' . $name . '</a>
<span class="size">' . size(filesize($dir . '/' . $name)) . '</span>,
<a href="file_chmod.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '" class="chmod">' . $perms . '</a>
echo '<li class="normal"><input type="checkbox" name="all" value="1" onClick="javascript:onCheckItem();"/> <strong class="form_checkbox_all"> Select all</strong></li>';
if (isset($configs['page_list']) && $configs['page_list'] > 0 && $pages['total'] > 1)
echo '<li class="normal">' . page($pages['current'], $pages['total'], array(PAGE_URL_DEFAULT => 'index.php?dir=' . $dirEncode, PAGE_URL_START => 'index.php?dir=' . $dirEncode . '&page_list=')) . '</li>';
<option value="0">Copy</option>
<option value="1">Move</option>
<option value="2">Delete</option>
<option value="4">Chmod</option>
<option value="5">Rename</option>
<input type="submit" name="submit" value="Go"/>
<div class="title">Function</div>
<li><img src="icon/create.png"/> <a href="create.php?dir=' . $dirEncode . $pages['paramater_1'] . '">Create new</a></li>
<li><img src="icon/upload.png"/> <a href="upload.php?dir=' . $dirEncode . $pages['paramater_1'] . '">Upload files</a></li>
<li><img src="icon/import.png"/> <a href="import.php?dir=' . $dirEncode . $pages['paramater_1'] . '">Import files</a></li>
include_once 'footer.php';