Log finding add
This commit is contained in:
parent
3d68df2658
commit
bde466a5bd
@ -16,15 +16,7 @@ class Log extends Template
|
|||||||
$template->prepare('title', 'Log');
|
$template->prepare('title', 'Log');
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$cdir = scandir('../logs/');
|
$result = $this->logFinder ('../logs/', $result);
|
||||||
foreach ($cdir as $key => $value)
|
|
||||||
{
|
|
||||||
if (!in_array($value,array(".","..", ".gitkeep")))
|
|
||||||
{
|
|
||||||
|
|
||||||
$result[$value] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->prepare('baseDir', BASEDIR);
|
$template->prepare('baseDir', BASEDIR);
|
||||||
$template->prepare('debugMod', DEBUGMOD);
|
$template->prepare('debugMod', DEBUGMOD);
|
||||||
@ -35,4 +27,20 @@ class Log extends Template
|
|||||||
|
|
||||||
$template->render();
|
$template->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function logFinder ($dir, $result) {
|
||||||
|
$logFiles = scandir ($dir);
|
||||||
|
foreach ($logFiles as $key => $file) {
|
||||||
|
if (in_array ($file,array (".", "..", ".gitkeep")))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!is_dir($dir . $file)) {
|
||||||
|
$result[$dir][] = $file;
|
||||||
|
} else {
|
||||||
|
$result = $this->logFinder ($dir . $file . "/", $result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,11 @@
|
|||||||
<div class="field">
|
<div class="field">
|
||||||
<select class="input" name="LogFile">
|
<select class="input" name="LogFile">
|
||||||
<?php foreach ($LOGSFILES as $key => $value) { ?>
|
<?php foreach ($LOGSFILES as $key => $value) { ?>
|
||||||
<option value="<?php echo $value; ?>"><?php echo $value; ?></option>
|
<optgroup label="<?php echo str_replace("../", "", $key); ?>">
|
||||||
|
<?php foreach ($value as $valueSub) { ?>
|
||||||
|
<option value="<?php echo $key . $valueSub; ?>"><?php echo $valueSub; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</optgroup>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -39,7 +43,7 @@
|
|||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
if (isset($_POST['LogFile'])) {
|
if (isset($_POST['LogFile'])) {
|
||||||
$file_lines = file('../logs/' . $_POST['LogFile']);
|
$file_lines = file($_POST['LogFile']);
|
||||||
echo '<pre style="overflow: auto;">';
|
echo '<pre style="overflow: auto;">';
|
||||||
foreach ($file_lines as $line) {
|
foreach ($file_lines as $line) {
|
||||||
echo $line;
|
echo $line;
|
||||||
|
Loading…
Reference in New Issue
Block a user