Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
pmtpro committed Jan 13, 2025
1 parent 38517df commit bd4db45
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 89 deletions.
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"require": {
"php": ">=7.4.0",
"ext-json": "*",
"ext-mysqli": "*",
"friendsofphp/php-cs-fixer": "^3.49",
"ngatngay/helper": "dev-main",
"ngatngay/ngatngay": "dev-main",
"sabre/dav": "dev-master"
},
"config": {
Expand Down
9 changes: 8 additions & 1 deletion lib/function.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use NgatNgay\Helper\Arr;

function request() {
return NgatNgay\Helper\request();
return NgatNgay\request();
}

function isAppFile($dir)
Expand Down Expand Up @@ -1013,3 +1013,10 @@ function getIcon($type, $name) {
return '<img src="https://cdn.ngatngay.net/icon/atom/assets/icons/files/' . $icon . '.svg">';
}
}

function showBack() {
echo '<a href="javascript:history.back()">
<img src="icon/back.png">
<strong class="back">Trở lại</strong>
</a>';
}
179 changes: 96 additions & 83 deletions scan_error_log.php
Original file line number Diff line number Diff line change
@@ -1,83 +1,96 @@
<?php

define('ACCESS', true);

require '.init.php';

$title = 'Tìm error_log';

require 'header.php';

echo '<style>
ul.info > li {
white-space: normal !important;
}
</style>';

echo '<div class="title">' . $title . '</div>';

if (
$dir == null
|| !is_dir(processDirectory($dir))
) {
echo '<div class="list"><span>Đường dẫn không tồn tại</span></div>
<div class="title">Chức năng</div>
<ul class="list">
<li><img src="icon/list.png"/> <a href="index.php' . $pages['paramater_0'] . '">Danh sách</a></li>
</ul>';
} else {
$dir = processDirectory($dir);

echo '<div class="list">';
echo '<span>' . printPath($dir, true) . '</span>';
echo '</div>';

echo '<div class="title">Danh sách error_log</div>';

$have_error = false;
$files = readFullDir($dir, [
'vendor/',
'node_modules/'
]);

foreach ($files as $file) {
if ($file->getFilename() !== 'error_log') {
continue;
}
if (!$file->getSize()) {
continue;
}

if (!$have_error) {
echo '<ul class="info">';
}

echo '<li>
<span class="bull">&bull;</span>
<a style="color: red" href="file.php?dir=' . rawurlencode(dirname($file->getPathname())) . '&name=' . $file->getFilename() . '">'
. htmlspecialchars(ltrim(
str_replace_first($dir, '', $file->getPathname())
, '/'))
. '</a> (' . size($file->getSize()) . ')
</li>';

if (!$have_error) {
$have_error = true;
}
}

if ($have_error) {
echo '</ul>';
}

if (!$have_error) {
echo '<div class="list">Trống</div>';
}

echo '<div class="title">Chức năng</div>
<ul class="list">
<li><img src="icon/list.png"/> <a href="index.php?dir=' . $dirEncode . $pages['paramater_1'] . '">Danh sách</a></li>
</ul>';
}

require 'footer.php';
<?php

define('ACCESS', true);

require '.init.php';

$title = 'Tìm error_log';

require 'header.php';

echo '<style>
ul.info > li {
white-space: normal !important;
}
</style>';

echo '<div class="title">' . $title . '</div>';

if (
$dir == null
|| !is_dir(processDirectory($dir))
) {
echo '<div class="list"><span>Đường dẫn không tồn tại</span></div>
<div class="title">Chức năng</div>
<ul class="list">
<li><img src="icon/list.png"/> <a href="index.php' . $pages['paramater_0'] . '">Danh sách</a></li>
</ul>';
} else {
$dir = processDirectory($dir);

echo '<div class="list">';
echo '<span>' . printPath($dir, true) . '</span>';
echo '</div>';

echo '<div class="title">Danh sách error_log</div>';

$have_error = false;
$files = readFullDir($dir, [
'vendor/',
'node_modules/'
]);

foreach ($files as $file) {
if ($file->getFilename() !== 'error_log') {
continue;
}

if (isset($_POST['clear'])) {
unlink($file->getPathname());
continue;
}

if (!$have_error) {
echo '<ul id="list" class="info">';
}

echo '<li>
<span class="bull">&bull;</span>
<a style="color: red" href="edit_text.php?dir=' . rawurlencode(dirname($file->getPathname())) . '&name=' . $file->getFilename() . '" target="_blank">'
. htmlspecialchars(ltrim(
str_replace_first($dir, '', $file->getPathname())
, '/'))
. '</a> (' . size($file->getSize()) . ')
</li>';

if (!$have_error) {
$have_error = true;
}
}

if ($have_error) {
echo '</ul>';
}

if (!$have_error) {
echo '<div class="list">Trống</div>';
}

echo '<div class="list"><button id="clear" class="button">Xoá hết</button></div>';
echo <<<'Z'
<script>
$('#clear').on('click', function () {
if (!confirm('Xoá hết error_log')) {
return;
}
$.post(window.location.href, {clear:1}, function () {
$('#list').empty();
});
});
</script>
Z;

showBack();
}

require 'footer.php';
4 changes: 2 additions & 2 deletions version.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"repo": "file-manager-main",
"major": 1,
"minor": 0,
"patch": 72,
"version": "1.0.72",
"patch": 73,
"version": "1.0.73",
"message": "fix"
}

0 comments on commit bd4db45

Please sign in to comment.