Edit File by line
/home/barbar84/www/extracte.../filemang...
File: file_viewzip.php
<?php
[0] Fix | Delete
[1] Fix | Delete
define('ACCESS', true);
[2] Fix | Delete
[3] Fix | Delete
include_once 'function.php';
[4] Fix | Delete
[5] Fix | Delete
[6] Fix | Delete
$title = 'See File Compressed source';
[7] Fix | Delete
$format = getFormat($name);
[8] Fix | Delete
[9] Fix | Delete
if ($dir == null || $name == null || !is_file(processDirectory($dir . '/' . $name))) {
[10] Fix | Delete
include_once 'header.php';
[11] Fix | Delete
[12] Fix | Delete
echo '<div class="title">' . $title . '</div>
[13] Fix | Delete
<div class="list"><span>The path does not exist</span></div>
[14] Fix | Delete
<div class="title">Function</div>
[15] Fix | Delete
<ul class="list">
[16] Fix | Delete
<li><img src="icon/list.png"/> <a href="index.php' . $pages['paramater_0'] . '">List</a></li>
[17] Fix | Delete
</ul>';
[18] Fix | Delete
} else if (!in_array($format, array('zip', 'jar'))) {
[19] Fix | Delete
include_once 'header.php';
[20] Fix | Delete
[21] Fix | Delete
echo '<div class="title">' . $title . '</div>
[22] Fix | Delete
<div class="list"><span>File không phải zip</span></div>
[23] Fix | Delete
<div class="title">Function</div>
[24] Fix | Delete
<ul class="list">
[25] Fix | Delete
<li><img src="icon/list.png"/> <a href="index.php?dir=' . $dirEncode . $pages['paramater_1'] . '">List</a></li>
[26] Fix | Delete
</ul>';
[27] Fix | Delete
} else {
[28] Fix | Delete
$title .= ':' . $name;
[29] Fix | Delete
[30] Fix | Delete
include_once 'header.php';
[31] Fix | Delete
include_once 'pclzip.lib.php';
[32] Fix | Delete
[33] Fix | Delete
$path = isset($_GET['path']) && !empty($_GET['path']) ? processPathZip($_GET['path']) : null;
[34] Fix | Delete
$dir = processDirectory($dir);
[35] Fix | Delete
$format = getFormat($name);
[36] Fix | Delete
$zip = new PclZIP($dir . '/' . $name);
[37] Fix | Delete
$lists = $zip->listContent();
[38] Fix | Delete
$arrays = array('folders' => array(), 'files' => array());
[39] Fix | Delete
[40] Fix | Delete
if (!$lists) {
[41] Fix | Delete
echo '<div class="title">' . $title . '</div>
[42] Fix | Delete
<div class="list">
[43] Fix | Delete
<span>' . printPath($dir . '/' . $name) . '</span><hr/>
[44] Fix | Delete
<span>File Compressed source bị lỗi không mở được</span>
[45] Fix | Delete
</div>';
[46] Fix | Delete
} else {
[47] Fix | Delete
$base = $path == null || empty($path) ? null : $path . '/';
[48] Fix | Delete
[49] Fix | Delete
foreach ($lists AS $entry) {
[50] Fix | Delete
$filename = $entry['filename'];
[51] Fix | Delete
[52] Fix | Delete
if (strpos($filename, '/') === false && $base == null) {
[53] Fix | Delete
$arrays['files'][$filename] = array('path' => $filename, 'name' => $filename, 'folder' => false, 'size' => $entry['size']);
[54] Fix | Delete
} else if (preg_match('#(' . $base . '(.+?))(/|$)+#', $filename, $matches)) {
[55] Fix | Delete
if ($matches[3] == '/' && !isset($arrays['folders'][$matches[2]]))
[56] Fix | Delete
$arrays['folders'][$matches[2]] = array('path' => $matches[1], 'name' => $matches[2], 'folder' => true);
[57] Fix | Delete
else if ($matches[3] != '/' && !$entry['folder'])
[58] Fix | Delete
$arrays['files'][$matches[2]] = array('path' => $matches[1], 'name' => $matches[2], 'folder' => false, 'size' => $entry['size']);
[59] Fix | Delete
}
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
$sorts = array();
[63] Fix | Delete
[64] Fix | Delete
if (count($arrays['folders']) > 0) {
[65] Fix | Delete
ksort($arrays['folders']);
[66] Fix | Delete
[67] Fix | Delete
foreach ($arrays['folders'] AS $entry)
[68] Fix | Delete
$sorts[] = $entry;
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
if (count($arrays['files']) > 0) {
[72] Fix | Delete
ksort($arrays['files']);
[73] Fix | Delete
[74] Fix | Delete
foreach ($arrays['files'] AS $entry)
[75] Fix | Delete
$sorts[] = $entry;
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
array_splice($arrays, 0, count($arrays));
[79] Fix | Delete
[80] Fix | Delete
$arrays = $sorts;
[81] Fix | Delete
$count = count($arrays);
[82] Fix | Delete
$root = 'root';
[83] Fix | Delete
$html = null;
[84] Fix | Delete
[85] Fix | Delete
array_splice($sorts, 0, count($sorts));
[86] Fix | Delete
unset($sorts);
[87] Fix | Delete
[88] Fix | Delete
if ($path != null && strpos($path, '/') !== false) {
[89] Fix | Delete
$array = explode('/', preg_replace('|^/(.*?)$|', '\1', $path));
[90] Fix | Delete
$html = '/<a href="file_viewzip.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">' . $root . '</a>';
[91] Fix | Delete
$item = null;
[92] Fix | Delete
$url = null;
[93] Fix | Delete
[94] Fix | Delete
foreach ($array AS $key => $entry) {
[95] Fix | Delete
if ($key === 0) {
[96] Fix | Delete
$seperator = preg_match('|^\/(.*?)$|', $path) ? '/' : null;
[97] Fix | Delete
$item = $seperator . $entry;
[98] Fix | Delete
} else {
[99] Fix | Delete
$item = '/' . $entry;
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
if ($key < count($array) - 1)
[103] Fix | Delete
$html .= '/<a href="file_viewzip.php?dir=' . $dirEncode . '&name=' . $name . '&path=' . rawurlencode($url . $item) . $pages['paramater_1'] . '">';
[104] Fix | Delete
else
[105] Fix | Delete
$html .= '/';
[106] Fix | Delete
[107] Fix | Delete
$url .= $item;
[108] Fix | Delete
[109] Fix | Delete
if (strlen($entry) <= 8)
[110] Fix | Delete
$html .= $entry;
[111] Fix | Delete
else
[112] Fix | Delete
$html .= substr($entry, 0, 8) . '...';
[113] Fix | Delete
[114] Fix | Delete
if ($key < count($array) - 1)
[115] Fix | Delete
$html .= '</a>';
[116] Fix | Delete
}
[117] Fix | Delete
} else {
[118] Fix | Delete
if ($path == null)
[119] Fix | Delete
$html = '/' . $root;
[120] Fix | Delete
else
[121] Fix | Delete
$html = '/<a href="file_viewzip.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">' . $root . '</a>/' . $path;
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
echo '<script language="javascript" src="checkbox.js"></script>';
[125] Fix | Delete
echo '<div class="title">' . $html . '</div>';
[126] Fix | Delete
echo '<ul class="list_file">';
[127] Fix | Delete
echo '<li class="normal">
[128] Fix | Delete
<span>' . printPath($dir . '/' . $name) . '</span>
[129] Fix | Delete
</li>';
[130] Fix | Delete
[131] Fix | Delete
if ($path != null) {
[132] Fix | Delete
$back = strrchr($path, '/');
[133] Fix | Delete
[134] Fix | Delete
if ($back !== false)
[135] Fix | Delete
$back = 'file_viewzip.php?dir=' . $dirEncode . '&name=' . $name . '&path=' . rawurlencode(substr($path, 0, strlen($path) - strlen($back))) . $pages['paramater_1'];
[136] Fix | Delete
else
[137] Fix | Delete
$back = 'file_viewzip.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'];
[138] Fix | Delete
[139] Fix | Delete
echo '<li class="normal">
[140] Fix | Delete
<img src="icon/back.png" style="margin-left: 5px; margin-right: 5px"/>
[141] Fix | Delete
<a href="' . $back . '">
[142] Fix | Delete
<strong class="back">...</strong>
[143] Fix | Delete
</a>
[144] Fix | Delete
</li>';
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
if ($count <= 0) {
[148] Fix | Delete
echo '<li class="normal"><img src="icon/empty.png"/> <span class="empty">No Folders or Files</span></li>';
[149] Fix | Delete
} else {
[150] Fix | Delete
foreach ($arrays AS $key => $value) {
[151] Fix | Delete
$pathEncode = rawurlencode($value['path']);
[152] Fix | Delete
[153] Fix | Delete
if ($value['folder']) {
[154] Fix | Delete
echo '<li class="folder">
[155] Fix | Delete
<div>
[156] Fix | Delete
<img src="icon/folder.png" style="margin-left: 5px"/>
[157] Fix | Delete
<a href="file_viewzip.php?dir=' . $dirEncode . '&name=' . $name . '&path=' . $pathEncode . $pages['paramater_1'] . '">' . $value['name'] . '</a>
[158] Fix | Delete
</div>
[159] Fix | Delete
</li>';
[160] Fix | Delete
} else {
[161] Fix | Delete
$icon = 'unknown';
[162] Fix | Delete
$type = getFormat($value['name']);
[163] Fix | Delete
[164] Fix | Delete
if (in_array($type, $formats['other']))
[165] Fix | Delete
$icon = $type;
[166] Fix | Delete
else if (in_array($type, $formats['text']))
[167] Fix | Delete
$icon = $type;
[168] Fix | Delete
else if (in_array($type, $formats['archive']))
[169] Fix | Delete
$icon = $type;
[170] Fix | Delete
else if (in_array($type, $formats['audio']))
[171] Fix | Delete
$icon = $type;
[172] Fix | Delete
else if (in_array($type, $formats['font']))
[173] Fix | Delete
$icon = $type;
[174] Fix | Delete
else if (in_array($type, $formats['binary']))
[175] Fix | Delete
$icon = $type;
[176] Fix | Delete
else if (in_array($type, $formats['document']))
[177] Fix | Delete
$icon = $type;
[178] Fix | Delete
else if (in_array($type, $formats['image']))
[179] Fix | Delete
$icon = 'image';
[180] Fix | Delete
else if (in_array(strtolower(strpos($name, '.') !== false ? substr($name, 0, strpos($name, '.')) : $name), $formats['source']))
[181] Fix | Delete
$icon = strtolower(strpos($name, '.') !== false ? substr($name, 0, strpos($name, '.')) : $name);
[182] Fix | Delete
[183] Fix | Delete
echo '<li class="file">
[184] Fix | Delete
<p>
[185] Fix | Delete
<img src="icon/mime/' . $icon . '.png" style="margin-left: 5px"/>
[186] Fix | Delete
<span>' . $value['name'] . '</span>
[187] Fix | Delete
</p>
[188] Fix | Delete
<p>
[189] Fix | Delete
<span class="size">' . size($value['size']) . '</span>
[190] Fix | Delete
</p>
[191] Fix | Delete
</li>';
[192] Fix | Delete
}
[193] Fix | Delete
}
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
echo '</ul>';
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
echo '<div class="title">Function</div>
[200] Fix | Delete
<ul class="list">
[201] Fix | Delete
<li><img src="icon/info.png"/> <a href="file.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Information</a></li>
[202] Fix | Delete
<li><img src="icon/unzip.png"/> <a href="file_unzip.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Solve Compressed source</a></li>
[203] Fix | Delete
<li><img src="icon/download.png"/> <a href="file_download.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Download</a></li>
[204] Fix | Delete
<li><img src="icon/rename.png"/> <a href="file_rename.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Rename</a></li>
[205] Fix | Delete
<li><img src="icon/copy.png"/> <a href="file_copy.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Copy</a></li>
[206] Fix | Delete
<li><img src="icon/Copy.png"/> <a href="file_Copy.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Move</a></li>
[207] Fix | Delete
<li><img src="icon/delete.png"/> <a href="file_delete.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Delete</a></li>
[208] Fix | Delete
<li><img src="icon/access.png"/> <a href="file_chmod.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Chmod</a></li>
[209] Fix | Delete
<li><img src="icon/list.png"/> <a href="index.php?dir=' . $dirEncode . $pages['paramater_1'] . '">List</a></li>
[210] Fix | Delete
</ul>';
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
include_once 'footer.php';
[214] Fix | Delete
[215] Fix | Delete
[216] Fix | Delete
?>
[217] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function