fix: address code review feedback (comment clarity, remove redundant static array, add CSS class)
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/86bb1e0e-2bbd-439b-88cd-7a624ad24761 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
5c463d381f
commit
d0c86926bd
3 changed files with 2 additions and 9 deletions
2
home.php
2
home.php
|
|
@ -234,7 +234,7 @@ function ogpHome()
|
|||
if ($isAdmin) {
|
||||
$xml_errors = function_exists('gsp_get_xml_errors') ? gsp_get_xml_errors() : array();
|
||||
if (!empty($xml_errors)) {
|
||||
echo "<div style='background:#fff3cd;border:1px solid #ffc107;border-radius:4px;padding:10px 14px;margin:10px 0;color:#856404;font-size:0.9em;'>";
|
||||
echo "<div class='gsp-xml-error-banner' style='background:#fff3cd;border:1px solid #ffc107;border-radius:4px;padding:10px 14px;margin:10px 0;color:#856404;font-size:0.9em;'>";
|
||||
echo "<strong>⚠ One or more game config XML files failed to load and have been skipped:</strong><ul style='margin:6px 0 0 16px;'>";
|
||||
foreach ($xml_errors as $xe) {
|
||||
echo "<li><code>" . htmlspecialchars(basename($xe['file']), ENT_QUOTES, 'UTF-8') . "</code>: "
|
||||
|
|
|
|||
|
|
@ -63,14 +63,6 @@ if (!function_exists('gsp_collect_xml_error')) {
|
|||
$log_message = "[GSP] $title" . (empty($details) ? '' : ' Details: ' . $details);
|
||||
error_log($log_message);
|
||||
|
||||
static $errors = [];
|
||||
$errors[] = array(
|
||||
'file' => $file,
|
||||
'title' => $title,
|
||||
'details' => $details,
|
||||
);
|
||||
// Store in a predictable global so callers (e.g. home.php) can read it
|
||||
// even across include boundaries without having to call the function.
|
||||
$GLOBALS['_gsp_xml_errors'][] = array(
|
||||
'file' => $file,
|
||||
'title' => $title,
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ class rss_php {
|
|||
$rss = ltrim($rss);
|
||||
|
||||
// Reject obviously non-XML content early to avoid noisy libxml warnings.
|
||||
// Minimum well-formed XML is at least "<a/>" (4 bytes); require one more.
|
||||
if(strlen($rss) < 5 || $rss[0] !== '<') {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue