Edit File by line
/home/barbar84/public_h.../extracte.../filemang...
File: action.php
<?php
[0] Fix | Delete
[1] Fix | Delete
[2] Fix | Delete
[3] Fix | Delete
const ACCESS = true;
[4] Fix | Delete
[5] Fix | Delete
include_once 'function.php';
[6] Fix | Delete
[7] Fix | Delete
[8] Fix | Delete
[9] Fix | Delete
[10] Fix | Delete
$title = 'ACT';
[11] Fix | Delete
$entry = $_POST['entry'] ?? [];
[12] Fix | Delete
$option = isset($_POST['option']) ? intval($_POST['option']) : -1;
[13] Fix | Delete
[14] Fix | Delete
if ($dir == null || !is_dir(processDirectory($dir))) {
[15] Fix | Delete
include_once 'header.php';
[16] Fix | Delete
[17] Fix | Delete
echo '<div class="title">' . $title . '</div>
[18] Fix | Delete
<div class="list"><span>The path does not exist</span></div>
[19] Fix | Delete
<div class="title">Function</div>
[20] Fix | Delete
<ul class="list">
[21] Fix | Delete
<li>
[22] Fix | Delete
<img src="icon/list.png" alt="" />
[23] Fix | Delete
<a href="index.php' . $pages['paramater_0'] . '">List</a>
[24] Fix | Delete
</li>
[25] Fix | Delete
</ul>';
[26] Fix | Delete
} elseif (!$_POST || ($option < 0 || $option > 5)) {
[27] Fix | Delete
include_once 'header.php';
[28] Fix | Delete
[29] Fix | Delete
echo '<div class="title">' . $title . '</div>
[30] Fix | Delete
<div class="list"><span>No action</span></div>
[31] Fix | Delete
<div class="title">Function</div>
[32] Fix | Delete
<ul class="list">
[33] Fix | Delete
<li><img src="icon/list.png" alt=""/> <a href="index.php?dir=' . $dirEncode . $pages['paramater_1'] . '">List</a></li>
[34] Fix | Delete
</ul>';
[35] Fix | Delete
} elseif (count($entry) <= 0) {
[36] Fix | Delete
include_once 'header.php';
[37] Fix | Delete
[38] Fix | Delete
echo '<div class="title">' . $title . '</div>
[39] Fix | Delete
<div class="list"><span>No choice</span></div>
[40] Fix | Delete
<div class="title">Function</div>
[41] Fix | Delete
<ul class="list">
[42] Fix | Delete
<li><img src="icon/list.png" alt=""/> <a href="index.php?dir=' . $dirEncode . $pages['paramater_1'] . '">List</a></li>
[43] Fix | Delete
</ul>';
[44] Fix | Delete
} else {
[45] Fix | Delete
$dir = processDirectory($dir);
[46] Fix | Delete
$entryCheckbox = null;
[47] Fix | Delete
$entryHtmlList = null;
[48] Fix | Delete
[49] Fix | Delete
if ($option != 5)
[50] Fix | Delete
$entryHtmlList = '<ul class="list">';
[51] Fix | Delete
[52] Fix | Delete
foreach ($entry as $e) {
[53] Fix | Delete
$isFolder = is_dir($dir . '/' . $e);
[54] Fix | Delete
[55] Fix | Delete
$entryCheckbox .= '<input type="hidden" name="entry[]" value="' . $e . '" checked="checked"/>';
[56] Fix | Delete
[57] Fix | Delete
if ($option != 5)
[58] Fix | Delete
$entryHtmlList .= '<li>
[59] Fix | Delete
<img src="icon/' . ($isFolder ? 'folder' : 'file') . '.png" alt="" />'
[60] Fix | Delete
. ($isFolder ? '<strong class="folder_name">' . $e . '</strong>' : '<span class="file_name">' . $e . '</span>') . '
[61] Fix | Delete
</li>';
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
if ($option != 5)
[65] Fix | Delete
$entryHtmlList .= '</ul>';
[66] Fix | Delete
[67] Fix | Delete
if ($option === 0) {
[68] Fix | Delete
$title = 'Copy';
[69] Fix | Delete
[70] Fix | Delete
include_once 'header.php';
[71] Fix | Delete
[72] Fix | Delete
echo '<div class="title">' . $title . '</div>';
[73] Fix | Delete
[74] Fix | Delete
if (isset($_POST['submit']) && isset($_POST['is_action'])) {
[75] Fix | Delete
echo '<div class="notice_failure">';
[76] Fix | Delete
[77] Fix | Delete
if (empty($_POST['path']))
[78] Fix | Delete
echo 'Not fully entered information';
[79] Fix | Delete
elseif ($dir == processDirectory($_POST['path']))
[80] Fix | Delete
echo 'The new path must be different from the current path';
[81] Fix | Delete
elseif (!is_dir($_POST['path']))
[82] Fix | Delete
echo 'The new path does not exist';
[83] Fix | Delete
elseif (isPathNotPermission(processDirectory($_POST['path'])))
[84] Fix | Delete
echo 'You cannot Copy to the File Manager path';
[85] Fix | Delete
elseif (!copys($entry, $dir, processDirectory($_POST['path'])))
[86] Fix | Delete
echo 'Copy failure';
[87] Fix | Delete
else
[88] Fix | Delete
goURL('index.php?dir=' . $dirEncode . $pages['paramater_1']);
[89] Fix | Delete
[90] Fix | Delete
echo '</div>';
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
echo $entryHtmlList;
[94] Fix | Delete
echo '<div class="list">
[95] Fix | Delete
<span>' . printPath($dir, true) . '</span><hr/>
[96] Fix | Delete
<form action="action.php?dir=' . $dirEncode . $pages['paramater_1'] . '" method="post">
[97] Fix | Delete
<span class="bull">&bull; </span>New file path:<br/>
[98] Fix | Delete
<input type="text" name="path" value="' . ($_POST['path'] ?? $dir) . '" size="18"/><br/>
[99] Fix | Delete
<input type="hidden" name="is_action" value="1"/>
[100] Fix | Delete
<input type="hidden" name="option" value="' . $option . '"/>';
[101] Fix | Delete
[102] Fix | Delete
echo $entryCheckbox;
[103] Fix | Delete
[104] Fix | Delete
echo '<input type="submit" name="submit" value="Copy"/>
[105] Fix | Delete
</form>
[106] Fix | Delete
</div>';
[107] Fix | Delete
} elseif ($option === 1) {
[108] Fix | Delete
$title = 'Move';
[109] Fix | Delete
[110] Fix | Delete
include_once 'header.php';
[111] Fix | Delete
[112] Fix | Delete
echo '<div class="title">' . $title . '</div>';
[113] Fix | Delete
[114] Fix | Delete
if (isset($_POST['submit']) && isset($_POST['is_action'])) {
[115] Fix | Delete
echo '<div class="notice_failure">';
[116] Fix | Delete
[117] Fix | Delete
if (empty($_POST['path']))
[118] Fix | Delete
echo 'Not fully entered information';
[119] Fix | Delete
elseif ($dir == processDirectory($_POST['path']))
[120] Fix | Delete
echo 'The new path must be different from the current path';
[121] Fix | Delete
elseif (!is_dir($_POST['path']))
[122] Fix | Delete
echo 'The new path does not exist';
[123] Fix | Delete
elseif (isPathNotPermission(processDirectory($_POST['path'])))
[124] Fix | Delete
echo 'You cannot Move to the File Manager path';
[125] Fix | Delete
elseif (!Copys($entry, $dir, processDirectory($_POST['path'])))
[126] Fix | Delete
echo 'Move failure';
[127] Fix | Delete
else
[128] Fix | Delete
goURL('index.php?dir=' . $dirEncode . $pages['paramater_1']);
[129] Fix | Delete
[130] Fix | Delete
echo '</div>';
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
echo $entryHtmlList;
[134] Fix | Delete
echo '<div class="list">
[135] Fix | Delete
<span>' . printPath($dir, true) . '</span><hr/>
[136] Fix | Delete
<form action="action.php?dir=' . $dirEncode . $pages['paramater_1'] . '" method="post">
[137] Fix | Delete
<span class="bull">&bull; </span>New file path:<br/>
[138] Fix | Delete
<input type="text" name="path" value="' . ($_POST['path'] ?? $dir) . '" size="18"/><br/>
[139] Fix | Delete
<input type="hidden" name="is_action" value="1"/>
[140] Fix | Delete
<input type="hidden" name="option" value="' . $option . '"/>';
[141] Fix | Delete
[142] Fix | Delete
echo $entryCheckbox;
[143] Fix | Delete
[144] Fix | Delete
echo '<input type="submit" name="submit" value="Move"/>
[145] Fix | Delete
</form>
[146] Fix | Delete
</div>';
[147] Fix | Delete
} elseif ($option === 2) {
[148] Fix | Delete
$title = 'Delete';
[149] Fix | Delete
[150] Fix | Delete
include_once 'header.php';
[151] Fix | Delete
[152] Fix | Delete
echo '<div class="title">' . $title . '</div>';
[153] Fix | Delete
[154] Fix | Delete
if (isset($_POST['accept'])) {
[155] Fix | Delete
if (isPathNotPermission(processDirectory($dir)))
[156] Fix | Delete
echo 'You cannot Delete File Manager items';
[157] Fix | Delete
elseif (!rrms($entry, $dir))
[158] Fix | Delete
echo '<div class="notice_failure">Delete failure</div>';
[159] Fix | Delete
else
[160] Fix | Delete
goURL('index.php?dir=' . $dirEncode . $pages['paramater_1']);
[161] Fix | Delete
} elseif (isset($_POST['not_accept'])) {
[162] Fix | Delete
goURL('index.php?dir=' . $dirEncode . $pages['paramater_1']);
[163] Fix | Delete
}
[164] Fix | Delete
[165] Fix | Delete
echo $entryHtmlList;
[166] Fix | Delete
echo '<div class="list">
[167] Fix | Delete
<span>' . printPath($dir, true) . '</span><hr/>
[168] Fix | Delete
<span>Do you really want to Delete the selected items?</span><hr/><br/>
[169] Fix | Delete
<center>
[170] Fix | Delete
<form action="action.php?dir=' . $dirEncode . $pages['paramater_1'] . '" method="post">
[171] Fix | Delete
<input type="hidden" name="is_action" value="1"/>
[172] Fix | Delete
<input type="hidden" name="option" value="' . $option . '"/>';
[173] Fix | Delete
[174] Fix | Delete
echo $entryCheckbox;
[175] Fix | Delete
[176] Fix | Delete
echo '<input type="submit" name="accept" value="Agree "/>
[177] Fix | Delete
<input type="submit" name="not_accept" value="Cancel"/>
[178] Fix | Delete
</form>
[179] Fix | Delete
</center>
[180] Fix | Delete
</div>';
[181] Fix | Delete
} elseif ($option === 3) {
[182] Fix | Delete
$title = 'extract zip';
[183] Fix | Delete
[184] Fix | Delete
include_once 'header.php';
[185] Fix | Delete
[186] Fix | Delete
echo '<div class="title">' . $title . '</div>';
[187] Fix | Delete
[188] Fix | Delete
if (isset($_POST['submit']) && isset($_POST['is_action'])) {
[189] Fix | Delete
echo '<div class="notice_failure">';
[190] Fix | Delete
[191] Fix | Delete
if (empty($_POST['name']) || empty($_POST['path']))
[192] Fix | Delete
echo 'Not fully entered information';
[193] Fix | Delete
elseif (isset($_POST['is_delete']) && processDirectory($_POST['path']) == $dir . '/' . $name)
[194] Fix | Delete
echo 'If you choose Delete Folder, you cannot save the Compressed source file there';
[195] Fix | Delete
elseif (isPathNotPermission(processDirectory($_POST['path'])))
[196] Fix | Delete
echo 'You cannot Compressed source File zip to File Manager path';
[197] Fix | Delete
elseif (isNameError($_POST['name']))
[198] Fix | Delete
echo 'File name zip illegal';
[199] Fix | Delete
elseif (!zips($dir, $entry, processDirectory($_POST['path'] . '/' . processName($_POST['name'])), isset($_POST['is_delete'])))
[200] Fix | Delete
echo 'extract zip failure';
[201] Fix | Delete
else
[202] Fix | Delete
goURL('index.php?dir=' . $dirEncode . $pages['paramater_1']);
[203] Fix | Delete
[204] Fix | Delete
echo '</div>';
[205] Fix | Delete
}
[206] Fix | Delete
[207] Fix | Delete
echo $entryHtmlList;
[208] Fix | Delete
echo '<div class="list">
[209] Fix | Delete
<span>' . printPath($dir, true) . '</span><hr/>
[210] Fix | Delete
<form action="action.php?dir=' . $dirEncode . $pages['paramater_1'] . '" method="post">
[211] Fix | Delete
<span class="bull">&bull; </span>Compressed file name:<br/>
[212] Fix | Delete
<input type="text" name="name" value="' . ($_POST['name'] ?? 'archive.zip') . '" size="18"/><br/>
[213] Fix | Delete
<span class="bull">&bull; </span>Save path:<br/>
[214] Fix | Delete
<input type="text" name="path" value="' . ($_POST['path'] ?? $dir) . '" size="18"/><br/>
[215] Fix | Delete
<input type="checkbox" name="is_delete" value="1"' . (isset($_POST['is_delete']) ? ' checked="checked"' : null) . '/> Delete the<br/>
[216] Fix | Delete
<input type="hidden" name="is_action" value="1"/>
[217] Fix | Delete
<input type="hidden" name="option" value="' . $option . '"/>';
[218] Fix | Delete
[219] Fix | Delete
echo $entryCheckbox;
[220] Fix | Delete
[221] Fix | Delete
echo '<input type="submit" name="submit" value="Compressed source"/>
[222] Fix | Delete
</form>
[223] Fix | Delete
</div>';
[224] Fix | Delete
} elseif ($option === 4) {
[225] Fix | Delete
$title = 'Chmod';
[226] Fix | Delete
[227] Fix | Delete
include_once 'header.php';
[228] Fix | Delete
[229] Fix | Delete
echo '<div class="title">' . $title . '</div>';
[230] Fix | Delete
[231] Fix | Delete
if (isset($_POST['submit']) && isset($_POST['is_action'])) {
[232] Fix | Delete
echo '<div class="notice_failure">';
[233] Fix | Delete
[234] Fix | Delete
if (empty($_POST['folder']) || empty($_POST['file']))
[235] Fix | Delete
echo 'Not fully entered information';
[236] Fix | Delete
elseif (!chmods($dir, $entry, $_POST['folder'], $_POST['file']))
[237] Fix | Delete
echo 'Chmod failure';
[238] Fix | Delete
else
[239] Fix | Delete
goURL('index.php?dir=' . $dirEncode . $pages['paramater_1']);
[240] Fix | Delete
[241] Fix | Delete
echo '</div>';
[242] Fix | Delete
}
[243] Fix | Delete
[244] Fix | Delete
echo $entryHtmlList;
[245] Fix | Delete
echo '<div class="list">
[246] Fix | Delete
<span>' . printPath($dir, true) . '</span><hr/>
[247] Fix | Delete
<form action="action.php?dir=' . $dirEncode . $pages['paramater_1'] . '" method="post">
[248] Fix | Delete
<span class="bull">&bull; </span>Folder:<br/>
[249] Fix | Delete
<input type="text" name="folder" value="' . ($_POST['folder'] ?? '755') . '" size="18"/><br/>
[250] Fix | Delete
<span class="bull">&bull; </span>File:<br/>
[251] Fix | Delete
<input type="text" name="file" value="' . ($_POST['file'] ?? '644') . '" size="18"/><br/>
[252] Fix | Delete
<input type="hidden" name="is_action" value="1"/>
[253] Fix | Delete
<input type="hidden" name="option" value="' . $option . '"/>';
[254] Fix | Delete
[255] Fix | Delete
echo $entryCheckbox;
[256] Fix | Delete
[257] Fix | Delete
echo '<input type="submit" name="submit" value="Chmod"/>
[258] Fix | Delete
</form>
[259] Fix | Delete
</div>';
[260] Fix | Delete
} elseif ($option === 5) {
[261] Fix | Delete
$title = 'Rename';
[262] Fix | Delete
$modifier = $entry;
[263] Fix | Delete
[264] Fix | Delete
include_once 'header.php';
[265] Fix | Delete
[266] Fix | Delete
echo '<div class="title">' . $title . '</div>';
[267] Fix | Delete
[268] Fix | Delete
if (isset($_POST['submit']) && isset($_POST['is_action'])) {
[269] Fix | Delete
$modifier = $_POST['modifier'];
[270] Fix | Delete
$isFailed = false;
[271] Fix | Delete
$isSucceed = true;
[272] Fix | Delete
[273] Fix | Delete
foreach ($modifier as $k => $e) {
[274] Fix | Delete
$entryPath = $dir . '/' . $entry[$k];
[275] Fix | Delete
[276] Fix | Delete
if (empty($e)) {
[277] Fix | Delete
$isFailed = true;
[278] Fix | Delete
[279] Fix | Delete
echo '<div class="notice_failure">Do not leave any box blank</div>';
[280] Fix | Delete
break;
[281] Fix | Delete
} elseif (isNameError($e)) {
[282] Fix | Delete
$isFailed = true;
[283] Fix | Delete
$entryLabel = is_dir($entryPath) ? 'Folder' : 'File';
[284] Fix | Delete
$entryCss = is_dir($entryPath) ? 'folder' : 'file';
[285] Fix | Delete
[286] Fix | Delete
echo '<div class="notice_failure">Name ' . $entryLabel . ' <strong class="' . $entryCss . '_name_rename_action">' . $entry[$k] . '</strong> <strong>=></strong> <strong class="' . $entryCss . '_name_rename_action">' . $e . '</strong> illegal</div>';
[287] Fix | Delete
break;
[288] Fix | Delete
} elseif (countStringArray($modifier, strtolower($e), true) > 1 && $e != $entry[$k]) {
[289] Fix | Delete
$isFailed = true;
[290] Fix | Delete
$entryLabel = is_dir($entryPath) ? 'Folder' : 'File';
[291] Fix | Delete
$entryCss = is_dir($entryPath) ? 'folder' : 'file';
[292] Fix | Delete
[293] Fix | Delete
echo '<div class="notice_failure">Name ' . $entryLabel . ' <strong class="' . $entryCss . '_name_rename_action">' . $entry[$k] . '</strong> <strong>=></strong> <strong class="' . $entryCss . '_name_rename_action">' . $e . '</strong> This already exists in another input frame</div>';
[294] Fix | Delete
break;
[295] Fix | Delete
} elseif (!isInArray($entry, strtolower($e), true) && file_exists($dir . '/' . $e)) {
[296] Fix | Delete
$isFailed = true;
[297] Fix | Delete
$entryLabel = is_dir($entryPath) ? 'Folder' : 'File';
[298] Fix | Delete
$entryCss = is_dir($entryPath) ? 'folder' : 'file';
[299] Fix | Delete
[300] Fix | Delete
echo '<div class="notice_failure">Name ' . $entryLabel . ' <strong class="' . $entryCss . '_name_rename_action">' . $entry[$k] . '</strong> <strong>=></strong> <strong class="' . $entryCss . '_name_rename_action">' . $e . '</strong> This already exists</div>';
[301] Fix | Delete
break;
[302] Fix | Delete
}
[303] Fix | Delete
}
[304] Fix | Delete
[305] Fix | Delete
if (!$isFailed) {
[306] Fix | Delete
$isSucceed = true;
[307] Fix | Delete
$rand = md5(rand(1000, 99999) . '-' . $dir);
[308] Fix | Delete
$rand = substr($rand, 0, strlen($rand) >> 1);
[309] Fix | Delete
[310] Fix | Delete
foreach ($entry as $e) {
[311] Fix | Delete
$entryPath = $dir . '/' . $e;
[312] Fix | Delete
[313] Fix | Delete
@rename($entryPath, $entryPath . '-' . $rand);
[314] Fix | Delete
}
[315] Fix | Delete
[316] Fix | Delete
foreach ($entry as $k => $e) {
[317] Fix | Delete
$entryPath = $dir . '/' . $e;
[318] Fix | Delete
$entryLabel = is_dir($entryPath) ? 'Folder' : 'File';
[319] Fix | Delete
$entryCss = is_dir($entryPath) ? 'folder' : 'file';
[320] Fix | Delete
[321] Fix | Delete
if (!@rename($entryPath . '-' . $rand, $dir . '/' . processName($modifier[$k]))) {
[322] Fix | Delete
$isSucceed = false;
[323] Fix | Delete
[324] Fix | Delete
echo '<div class="notice_failure">Rename ' . $entryLabel . ' <strong class="' . $entryCss . '_name_rename_action">' . $e . '</strong> <strong>=></strong> <strong class="' . $entryCss . '_name_rename_action">' . $modifier[$k] . '</strong> failure</div>';
[325] Fix | Delete
} else {
[326] Fix | Delete
$entry[$k] = $modifier[$k];
[327] Fix | Delete
[328] Fix | Delete
echo '<div class="notice_succeed">Rename ' . $entryLabel . ' <strong class="' . $entryCss . '_name_rename_action">' . $e . '</strong> <strong>=></strong> <strong class="' . $entryCss . '_name_rename_action">' . $modifier[$k] . '</strong> successfully</div>';
[329] Fix | Delete
}
[330] Fix | Delete
}
[331] Fix | Delete
}
[332] Fix | Delete
[333] Fix | Delete
if (!$isFailed && $isSucceed)
[334] Fix | Delete
goURL('index.php?dir=' . $dirEncode . $pages['paramater_1']);
[335] Fix | Delete
}
[336] Fix | Delete
[337] Fix | Delete
echo $entryHtmlList;
[338] Fix | Delete
echo '<div class="list ellipsis break-word">
[339] Fix | Delete
<span>' . printPath($dir, true) . '</span><hr/>
[340] Fix | Delete
<form action="action.php?dir=' . $dirEncode . $pages['paramater_1'] . '" method="post">';
[341] Fix | Delete
[342] Fix | Delete
for ($i = 0; $i < count($entry); ++$i) {
[343] Fix | Delete
$entryPath = $dir . '/' . $entry[$i];
[344] Fix | Delete
$entryName = $entry[$i];
[345] Fix | Delete
[346] Fix | Delete
if (is_dir($entryPath))
[347] Fix | Delete
echo '<span class="bull">&bull; </span>Name Folder (<strong class="folder_name_rename_action">' . $entryName . '</strong>):<br/>';
[348] Fix | Delete
else
[349] Fix | Delete
echo '<span class="bull">&bull; </span>File name (<strong class="file_name_rename_action">' . $entryName . '</strong>):<br/>';
[350] Fix | Delete
[351] Fix | Delete
echo '<input type="text" name="modifier[]" value="' . $modifier[$i] . '" size="18"/><br/>';
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
echo '<input type="hidden" name="is_action" value="1"/>
[355] Fix | Delete
<input type="hidden" name="option" value="' . $option . '"/>';
[356] Fix | Delete
[357] Fix | Delete
echo $entryCheckbox;
[358] Fix | Delete
[359] Fix | Delete
echo '<input type="submit" name="submit" value="Rename"/>
[360] Fix | Delete
</form>
[361] Fix | Delete
</div>';
[362] Fix | Delete
}
[363] Fix | Delete
[364] Fix | Delete
echo '<div class="title">Function</div>
[365] Fix | Delete
<ul class="list">
[366] Fix | Delete
<li><img src="icon/list.png" alt=""/> <a href="index.php?dir=' . $dirEncode . $pages['paramater_1'] . '">List</a></li>
[367] Fix | Delete
</ul>';
[368] Fix | Delete
}
[369] Fix | Delete
[370] Fix | Delete
include_once 'footer.php';
[371] Fix | Delete
[372] Fix | Delete
[373] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function