www_archline_hu/cadline/backend/maintenance2/maintenance/crashadmin.php
LÁZÁR Imre AI Agent edb18f07b5 feat(cadline): add common_cadline_libraries + maintenance backend
common_cadline_libraries (CRM hardlock/db/users classes; upstream cadline_web/cadcommonlib), maintenance/ (ARCHLine.XP license backend; upstream cadline_web/maintenance), maintenance2/. Vetted live files (byte-truth); upstream repos in PROVENANCE.md. NOTE: could be git submodules — kept as live files for byte-fidelity.

Signed-off-by: LÁZÁR Imre <imre@illusion.hu>
Assisted-by: claude-code@claude-opus-4-8
2026-07-16 11:34:30 +02:00

449 lines
15 KiB
PHP

<?php
error_reporting(E_ERROR | E_PARSE);
session_start();
include('config.php');
$connection = new mysqli($config2['db_host'], $config2['db_user'], $config2['db_pass'], $config2['db_name']);
if (isset($_POST['submit'])) {
if ($_POST['modId']) {
$id = $_POST['modId'];
$text = mysqli_real_escape_string($connection, $_POST['modText']);
$update = "UPDATE `www_archline_hu`.`crash` SET `komment`='{$text}' WHERE `id`='{$id}'";
if ($connection->query($update) === FALSE) echo '<script type="text/javascript">alert("' . $connection->error . '");</script>';
}
if ($_POST['listaid'] && isset($_POST['CbBoxValue'])) {
$listaid = substr($_POST['listaid'], 5);
$update = "UPDATE `www_archline_hu`.`crash` SET `eredmeny`='{$_POST['CbBoxValue']}' WHERE `id`='{$listaid}'";
if ($connection->query($update) === FALSE) echo '<script type="text/javascript">alert("' . $connection->error . '");</script>';
}
}
function downloadFile($filename)
{
if ($f = fopen($filename, "rb")) {
$content_len = (int) filesize($filename);
//@ini_set('zlib.output_compression', 'Off');
header('Pragma: public');
//header('Last-Modified: '.gmdate('D, d M Y H(idea)(worry)') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Content-Transfer-Encoding: none');
header('Content-Type: plain/text');
header('Content-Disposition: inline; filename="' . $filename . '"');
header("Content-length: $content_len");
while (!feof($f)) {
echo fread($f, 2 << 20);
}
fclose($f);
} else {
print "error opening file";
}
exit();
}
if (isset($_GET) && !empty($_GET)) {
$filepath = "/home/vendeg/crash/";
$filepath .= $_GET["guid"];
if (!file_exists($filepath))
$filepath = "../webdav/crash/" . $_GET['guid'];
downloadFile($filepath);
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<style>
#submit {
position: fixed;
right: 1%;
top: 1%;
}
.tr0 {
background-color: white;
}
.tr1 {
background-color: #33cc33;
}
.tr2,
.tr5,
.tr6 {
background-color: #ff5050;
}
.tr3 {
background-color: #cccccc;
}
.tr4 {
background-color: #99ff33;
}
.tr7 {
background-color: #808080;
}
.ta0 {
background-color: white;
}
.ta1 {
background-color: #33cc33;
}
.ta2,
.ta5,
.ta6 {
background-color: #ff5050;
}
.ta3 {
background-color: #cccccc;
}
.ta4 {
background-color: #99ff33;
}
.ta7 {
background-color: #808080;
}
</style>
<script>
var textId;
var CbBox;
function valtoztat(id) {
textId = id;
document.getElementById("modId").value = id;
}
function textChange() {
var x = document.getElementById(textId).value;
document.getElementById("modText").value = x;
var cbV = document.getElementById(CbBox).selectedIndex;
document.getElementById("CbBoxValue").value = cbV;
}
function cbboxid(CbId) {
var cbV = document.getElementById(CbId).selectedIndex;
document.getElementById("CbBoxValue").value = cbV;
document.getElementById("listaid").value = CbId;
CbBox = CbId;
}
</script>
</head>
<body>
<?php
$V0 = "Nem feldolgozott";
$V1 = "Javítva";
$V2 = "Nem debuggolható";
$V3 = "Nem értelmezhető";
$V4 = "Előzőleg javított";
$V5 = "Nem reprodukálható";
$V6 = "Nem javítható";
$V7 = "Nem feldolgozandó";
$V8 = "Mind";
if (isset($_POST['datemin'])) {
$_SESSION["mindate"] = $_POST['datemin'];
$_SESSION["maxdate"] = $_POST['datemax'];
$_SESSION["lista"] = $_POST['lista'];
$_SESSION['product'] = $_POST['product'];
}
$maxdate = date("Y-m-d");
$mindate = date("Y-m-d", strtotime("-5 days"));
echo '<form method="post" action="">';
if (isset($_SESSION["maxdate"]) || isset($_SESSION["mindate"]) || isset($_SESSION["lista"])) {
echo 'Dátum szűrés<br /> <input type="date" name="datemin" id="datemin" value="' . $_SESSION["mindate"] . '">-tól &nbsp;&nbsp;&nbsp; <input type="date" name="datemax" id="datemax" value="' . $_SESSION["maxdate"] . '">-ig';
} else {
echo 'Dátum szűrés<br /> <input type="date" name="datemin" id="datemin" value="' . $mindate . '">-tól &nbsp;&nbsp;&nbsp; <input type="date" name="datemax" id="datemax" value="' . $maxdate . '">-ig';
}
?>
<br /><br />
Eredmény szűrő:<br />
<select name="lista">
<option value="0" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "0") echo ' selected'; ?>><?php echo $V0; ?></option>
<option value="1" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "1") echo ' selected'; ?>><?php echo $V1; ?></option>
<option value="2" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "2") echo ' selected'; ?>><?php echo $V2; ?></option>
<option value="3" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "3") echo ' selected'; ?>><?php echo $V3; ?></option>
<option value="4" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "4") echo ' selected'; ?>><?php echo $V4; ?></option>
<option value="5" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "5") echo ' selected'; ?>><?php echo $V5; ?></option>
<option value="6" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "6") echo ' selected'; ?>><?php echo $V6; ?></option>
<option value="7" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "7") echo ' selected'; ?>><?php echo $V7; ?></option>
<option value="%" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "%") echo ' selected'; ?>><?php echo $V8; ?></option>
</select>
<select name="product">
<option value="0" <?php if (isset($_SESSION['product']) && $_SESSION['product'] == "0") echo ' selected'; ?>>Mind</option>
<option value="1" <?php if (isset($_SESSION['product']) && $_SESSION['product'] == "1") echo ' selected'; ?>>ARCHLine.XP</option>
<option value="2" <?php if (isset($_SESSION['product']) && $_SESSION['product'] == "2") echo ' selected'; ?>>LIVE</option>
</select>
<br /><br />
<input type="submit" value="Szűrés">
<br /><br />
</form>
<?php
$query = "SELECT * FROM `www_archline_hu`.`crash` ";
$feltetel = array();
if (isset($_POST['datemin'])) $feltetel[] = "left(datum, 10) >= '" . $_POST['datemin'] . "'";
if (isset($_POST['datemax'])) $feltetel[] = "left(datum, 10) <= '" . $_POST['datemax'] . "'";
if (isset($_POST['lista']) && $_POST['lista'] != "%") $feltetel[] = "`eredmeny` = " . $_POST['lista'] . "";
if (isset($_POST['lista']) && $_POST['lista'] == "%") $feltetel[] = "1";
if (isset($_POST['datemax']) || isset($_POST['datemin']) || isset($_POST['lezart'])) $query .= "WHERE " . implode(' AND ', $feltetel);
if (isset($_POST['product']) && $_POST['product'] != 0) {
if ($_POST['product'] == 1)
$query .= " AND SUBSTR(guid, 1, 5) NOT LIKE 'Live_%'";
if ($_POST['product'] == 2)
$query .= " AND SUBSTR(guid, 1, 5) LIKE 'Live_%'";
}
$query .= " ORDER BY id DESC LIMIT 500";
print "<form method='post' action='' onsubmit='textChange()'>";
print "<table border = 1>";
print "<tr>";
print "<th>Email</th>";
print "<th>Üzenet</th>";
print "<th>Dátum</th>";
print "<th>Dmp fájl</th>";
print "<th>Info fájl</th>";
print "<th>Megjegyzés</th>";
print "<th>Eredmény</th>";
print "</tr>";
$msh2->query($query);
$results = $msh2->fetchAssoc();
foreach ($results as $result) {
$r = (object)$result;
$filepathFtp = "/home/vendeg/crash/";
$filepathFtp .= $r->guid;
$filepathFtp .= ".DMP";
$filepathWebdav = "../webdav/crash/";
$filepathWebdav .= $r->guid;
$filepathWebdav .= ".DMP";
if (!file_exists($filepathFtp) && !file_exists($filepathWebdav))
continue;
print "<tr class='tr" . $r->eredmeny . "'>";
print "<td>";
print $r->email;
print "</td>";
print "<td style='width:300px'>";
print $r->info;
print "</td>";
print "<td>";
//print substr($r->datum,0,10);
print $r->datum;
print "</td>";
print "<td>";
?>
<a href="https://archline.hu/crashadmin/<?= $r->guid ?>.DMP"><?= $r->guid ?></a>
<?php
print "</td>";
print "<td>";
$infoPath = '/home/vendeg/crash/' . $r->guid . '.TXT';
$infoPathWebdav = '../webdav/crash/' . $r->guid . '.TXT';
$logPath = '/home/vendeg/crash/' . $r->guid . '.LOG';
$logPathWebdav = '../webdav/crash/' . $r->guid . '.LOG';
$logExtension = '.LOG';
$infoExtension = '.TXT';
if (!file_exists($infoPath) && !file_exists($infoPathWebdav)) {
$infoPath = '/home/vendeg/crash/' . $r->guid . '.XML';
$infoExtension = '.XML';
}
echo '<a href="https://archline.hu/crashadmin/' . $r->guid . $infoExtension . '">Info</a>';
if (file_exists($logPath) || file_exists($logPathWebdav)) {
echo ' <a href="https://archline.hu/crashadmin/' . $r->guid . $logExtension . '">Log</a>';
}
if (file_exists(infoPath)) {
$file = '/home/vendeg/crash/' . $r->guid . '.TXT';
if (!file_exists($file))
$file = infoPathWebdav;
$searchfor = 'developer';
$contents = file_get_contents($file);
$pattern = preg_quote($searchfor, '/');
$pattern = "/^.*$pattern.*\$/m";
if (preg_match_all($pattern, $contents, $matches))
echo "developer";
$searchfor = 'Product: render';
$contents = file_get_contents($file);
$pattern = preg_quote($searchfor, '/');
$pattern = "/^.*$pattern.*\$/m";
if (preg_match_all($pattern, $contents, $matches)) {
echo "render";
}
}
print "</td>";
print "<td>";
echo "<textarea rows='2' cols='60' class='ta" . $r->eredmeny . "' id='" . $r->id . "' onClick='valtoztat(this.id)'>" . $r->komment . "</textarea>";
print "</td>";
print "<td>";
switch ($r->eredmeny) {
case '0':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0" selected>' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '1':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1" selected>' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '2':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2" selected>' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '3':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3" selected>' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '4':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4" selected>' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '5':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5" selected>' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '6':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6" selected>' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '7':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7" selected>' . $V7 . '</option>
</select>
';
break;
}
print "</td>";
print "</tr>";
}
print '<input type="hidden" id="listaid" name="listaid" value="">';
print '<input type="hidden" id="CbBoxValue" name="CbBoxValue" value="">';
print '<input type="hidden" id="modId" name="modId" value="">';
print '<input type="hidden" id="modText" name="modText" value="">';
print '<input type="submit" value="Mentés" id="submit" name="submit">';
print "</table>";
?>
</body>
</html>
<?php
}
?>