Updated bug report system

This commit is contained in:
mattpass
2020-08-23 09:11:40 +01:00
parent 5343efd57f
commit 53cdbad35b
5 changed files with 73 additions and 18 deletions

10
assets/css/bug-report.css Normal file
View File

@@ -0,0 +1,10 @@
body {overflow: hidden;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px}
.bug-report {background-color: #1c1c19; color: #fff; padding: 20px}
pre {font-family: monospace}

View File

@@ -3594,6 +3594,12 @@ var ICEcoder = {
this.showHide('show',get('blackMask'));
},
// Show the auto-logout warning screen
bugReportScreen: function() {
get('mediaContainer').innerHTML = '<iframe src="'+iceLoc+'/lib/bug-report.php" id="bugReportIFrame" style="width: 970px; height: 610px"></iframe>';
this.showHide('show',get('blackMask'));
},
// Show the plugins manager
pluginsManager: function() {
get('mediaContainer').innerHTML = '<iframe src="'+iceLoc+'/lib/plugins-manager.php" id="pluginsManagerIFrame" style="width: 800px; height: 450px"></iframe>';
@@ -3909,11 +3915,12 @@ var ICEcoder = {
}
if(this.bugReportStatus=="bugs") {
// Close bug-report without saving previousFiles and without confirming close if we made changes on the bug report
var bugReportOpenFilePos = this.openFiles.indexOf(this.bugReportPath.replace(/\|/g,"/"));
if (bugReportOpenFilePos > -1) {
this.closeTab(bugReportOpenFilePos+1,'dontSetPV','dontAsk');
}
this.openFile(this.bugReportPath);
// var bugReportOpenFilePos = this.openFiles.indexOf(this.bugReportPath.replace(/\|/g,"/"));
// if (bugReportOpenFilePos > -1) {
// this.closeTab(bugReportOpenFilePos+1,'dontSetPV','dontAsk');
// }
// this.openFile(this.bugReportPath);
this.bugReportScreen();
this.bugFilesSizesSeen = this.bugFilesSizesActual;
}
},
@@ -3956,6 +3963,11 @@ var ICEcoder = {
statusArray['result'] == "ok" ? "#080" :
statusArray['result'] == "bugs" ? "#b00" :
"#f80"; // if the result is 'error' or another value
get('bugIcon').title =
statusArray['result'] == "off" ? "Bug reporting not active" :
statusArray['result'] == "ok" ? "No new errors found" :
statusArray['result'] == "bugs" ? "New bugs found, click to view" :
"Unable to find bug log file specified"; // Setup error
ic.bugReportStatus = statusArray['result'];
if (ic.bugFilesSizesSeen[0]=="null") {
ic.bugFilesSizesSeen = statusArray['filesSizesSeen'];

View File

@@ -121,6 +121,11 @@ $text = [
"Found in" => "Found in:",
],
"bug-report" =>
[
"Bug Report" => "Bug Report",
],
"file-control" =>
[
"Sorry, bad filename..." => "Sorry, bad filename provided. Check the dev tools console for more info?",

View File

@@ -1,14 +1,16 @@
<?php
// Load common functions
include "headers.php";
include_once "settings-common.php";
$text = $_SESSION['text'];
include "settings.php";
$t = $text['bug-files-check'];
// Classes
require_once "../classes/_ExtraProcesses.php";
require_once dirname(__FILE__) . "/../classes/_ExtraProcesses.php";
require_once dirname(__FILE__) . "/../classes/System.php";
use ICEcoder\ExtraProcesses;
use ICEcoder\System;
$systemClass = new System;
$files = explode(",", str_replace("|", "/", xssClean($_GET['files'], "html")));
$filesSizesSeen = explode(",", xssClean($_GET['filesSizesSeen'], "html"));
@@ -30,6 +32,7 @@ for ($i = 0; $i < count($files); $i++) {
if ("error" !== $result) {
$filesWithNewBugs = 0;
$output = "";
for ($i = 0; $i < count($files); $i++) {
// If we have set a filesize value previously and it's different to now, there's new bugs
@@ -54,7 +57,6 @@ if ("error" !== $result) {
if("\n" !== fread($f, 1)) $lines -= 1;
// Start reading
$output = "";
$chunk = "";
// While we would like more
@@ -86,16 +88,14 @@ if ("error" !== $result) {
$output = rtrim(str_replace("\r\n", "\n", $output));
$output = explode("\n", $output);
$output = array_slice($output, -$maxLines);
$output = $t['Found in'] . " " . $filename . "...\n" . implode("\n", $output);
if ($filesWithNewBugs==1) {
file_put_contents("../data/bug-report.log", $output);
} else {
file_put_contents("../data/bug-report.log", "\n\n" . $output, FILE_APPEND);
}
$output = "\n" . $t['Found in'] . " " . $filename . "...\n" . implode("\n", $output);
}
}
if (0 < $filesWithNewBugs) {
$settingsClass->serializedFileData("set", $docRoot . $ICEcoderDir . "/data/bug-report.php", serialize($output));
}
}
// Get dir name tmp dir's parent
@@ -108,7 +108,7 @@ $status = array(
"files" => $files,
"filesSizesSeen" => $filesSizesSeen,
"maxLines" => $maxLines,
"bugReportPath" => "|" . $dataLoc . "|data|bug-report.log",
"bugReportPath" => $dataLoc . "|data|bug-report.php",
"result" => $result
);

28
lib/bug-report.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
include "headers.php";
include "settings.php" ;
$t = $text['bug-report'];
?>
<!DOCTYPE html>
<html>
<head>
<title>ICEcoder <?php echo $ICEcoder["versionNo"];?> bug logs</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="../assets/css/resets.css?microtime=<?php echo microtime(true);?>">
<link rel="stylesheet" type="text/css" href="../assets/css/bug-report.css?microtime=<?php echo microtime(true);?>">
</head>
<body class="bug-report">
<h1 id="title"><?php echo $t['Bug Report'];?></h1>
<pre>
<?php
echo trim($settingsClass->serializedFileData("get", $docRoot . $ICEcoderDir . "/data/bug-report.php"));
?>
</pre>
</body>
</html>