diff --git a/home.php b/home.php index 31be3f63..3ccb3519 100644 --- a/home.php +++ b/home.php @@ -187,6 +187,12 @@ function ogpHome() foreach ((array)$servers_by_game_name as $game_name => $server_homes ) { $server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_homes[0]['home_cfg_file']); + if ($server_xml === FALSE) + { + // Bad XML – skip this game from the navigation list; error is + // already collected and will be shown to admins below. + continue; + } $mod = $server_homes[0]['mod_key']; // If query name does not exist use mod key instead. if ($server_xml->protocol == "gameq") @@ -223,6 +229,26 @@ function ogpHome() } else $game_homes_list = ""; + + // Show admin-only warning for any game config XMLs that failed to parse. + if ($isAdmin) { + $xml_errors = function_exists('gsp_get_xml_errors') ? gsp_get_xml_errors() : array(); + if (!empty($xml_errors)) { + echo "
" . htmlspecialchars(basename($xe['file']), ENT_QUOTES, 'UTF-8') . ": "
+ . htmlspecialchars($xe['title'], ENT_QUOTES, 'UTF-8');
+ if (!empty($xe['details'])) {
+ echo " — " . nl2br(htmlspecialchars($xe['details'], ENT_QUOTES, 'UTF-8')) . "";
+ }
+ echo "Use Game/Mod Config to edit and fix the broken file(s).
"; + echo "